@pie-lib/graphing 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.5.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing@2.5.0...@pie-lib/graphing@2.5.1) (2022-05-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **graphing:** removed problematic componentDidUpdate ([9347554](https://github.com/pie-framework/pie-lib/commit/93475543422bbb7a62d82121751c2e10969904ec))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing@2.4.17...@pie-lib/graphing@2.5.0) (2022-05-03)
7
18
 
8
19
 
@@ -123,16 +123,6 @@ var Root = /*#__PURE__*/function (_React$Component) {
123
123
  }
124
124
 
125
125
  _createClass(Root, [{
126
- key: "componentDidUpdate",
127
- value: function componentDidUpdate() {
128
- var marks = this.props.marks;
129
- var storeState = this.store.getState();
130
-
131
- if (!(0, _isEqual["default"])(storeState.marks.present, marks)) {
132
- this.store.dispatch((0, _actions.changeMarks)(marks));
133
- }
134
- }
135
- }, {
136
126
  key: "render",
137
127
  value: function render() {
138
128
  // eslint-disable-next-line no-unused-vars
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/container/index.jsx"],"names":["mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","GraphWithControls","Root","props","storeState","store","getState","r","subscribe","onStoreChange","rest","correctnessSet","find","correctness","React","Component","PropTypes","func","array"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA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Ae;AAAEnB,MAAAA,KAAK,EAAEe,KAAK,CAACf;AAAf,KAAf,CAAb;;AAEA,UAAKiB,KAAL,CAAWG,SAAX,CAAqB,MAAKC,aAA1B;;AANiB;AAOlB;;;;WAED,8BAAqB;AACnB,UAAQrB,KAAR,GAAkB,KAAKe,KAAvB,CAAQf,KAAR;AACA,UAAMgB,UAAU,GAAG,KAAKC,KAAL,CAAWC,QAAX,EAAnB;;AAEA,UAAI,CAAC,yBAAQF,UAAU,CAAChB,KAAX,CAAiBC,OAAzB,EAAkCD,KAAlC,CAAL,EAA+C;AAC7C,aAAKiB,KAAL,CAAWd,QAAX,CAAoB,0BAAYH,KAAZ,CAApB;AACD;AACF;;;WAUD,kBAAS;AACP;AACA,yBAA0C,KAAKe,KAA/C;AAAA,UAAQX,aAAR,gBAAQA,aAAR;AAAA,UAAuBJ,KAAvB,gBAAuBA,KAAvB;AAAA,UAAiCsB,IAAjC;;AACA,UAAMC,cAAc,GAAGvB,KAAK,IAAIA,KAAK,CAACwB,IAAN,CAAW,UAAAnB,CAAC;AAAA,eAAIA,CAAC,CAACoB,WAAN;AAAA,OAAZ,CAAhC;;AAEA,UAAIF,cAAJ,EAAoB;AAClB,4BAAO,gCAAC,6BAAD,eAAuBD,IAAvB;AAA6B,UAAA,KAAK,EAAEtB,KAApC;AAA2C,UAAA,QAAQ,EAAEuB;AAArD,WAAP;AACD;;AAED,0BACE,gCAAC,oBAAD;AAAU,QAAA,KAAK,EAAE,KAAKN;AAAtB,sBACE,gCAAC,cAAD,EAAoBK,IAApB,CADF,CADF;AAKD;;;;EA9CgBI,kBAAMC,S;;gBAAnBb,I,eACe;AACjBV,EAAAA,aAAa,EAAEwB,sBAAUC,IADR;AAEjB7B,EAAAA,KAAK,EAAE4B,sBAAUE;AAFA,C;;eAgDNhB,I","sourcesContent":["import { connect } from 'react-redux';\nimport React from 'react';\nimport { Provider } from 'react-redux';\nimport { createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\n\nconst mapStateToProps = s => ({\n marks: s.marks.present\n});\n\nconst mapDispatchToProps = dispatch => ({\n onChangeMarks: m => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([]))\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks });\n\n this.store.subscribe(this.onStoreChange);\n }\n\n componentDidUpdate() {\n const { marks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n this.store.dispatch(changeMarks(marks));\n }\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find(m => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/container/index.jsx"],"names":["mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","GraphWithControls","Root","props","storeState","store","getState","r","subscribe","onStoreChange","rest","correctnessSet","find","correctness","React","Component","PropTypes","func","array"],"mappings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,OAAlB,CAAb;AACD;AACF,KAhBkB;;AAGjB,QAAMkB,CAAC,GAAG,0BAAV;AACA,UAAKF,KAAL,GAAa,wBAAYE,CAAZ,EAAe;AAAEnB,MAAAA,KAAK,EAAEe,KAAK,CAACf;AAAf,KAAf,CAAb;;AAEA,UAAKiB,KAAL,CAAWG,SAAX,CAAqB,MAAKC,aAA1B;;AANiB;AAOlB;;;;WAWD,kBAAS;AACP;AACA,yBAA0C,KAAKN,KAA/C;AAAA,UAAQX,aAAR,gBAAQA,aAAR;AAAA,UAAuBJ,KAAvB,gBAAuBA,KAAvB;AAAA,UAAiCsB,IAAjC;;AACA,UAAMC,cAAc,GAAGvB,KAAK,IAAIA,KAAK,CAACwB,IAAN,CAAW,UAAAnB,CAAC;AAAA,eAAIA,CAAC,CAACoB,WAAN;AAAA,OAAZ,CAAhC;;AAEA,UAAIF,cAAJ,EAAoB;AAClB,4BAAO,gCAAC,6BAAD,eAAuBD,IAAvB;AAA6B,UAAA,KAAK,EAAEtB,KAApC;AAA2C,UAAA,QAAQ,EAAEuB;AAArD,WAAP;AACD;;AAED,0BACE,gCAAC,oBAAD;AAAU,QAAA,KAAK,EAAE,KAAKN;AAAtB,sBACE,gCAAC,cAAD,EAAoBK,IAApB,CADF,CADF;AAKD;;;;EAtCgBI,kBAAMC,S;;gBAAnBb,I,eACe;AACjBV,EAAAA,aAAa,EAAEwB,sBAAUC,IADR;AAEjB7B,EAAAA,KAAK,EAAE4B,sBAAUE;AAFA,C;;eAwCNhB,I","sourcesContent":["import { connect } from 'react-redux';\nimport React from 'react';\nimport { Provider } from 'react-redux';\nimport { createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\n\nconst mapStateToProps = s => ({\n marks: s.marks.present\n});\n\nconst mapDispatchToProps = dispatch => ({\n onChangeMarks: m => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([]))\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks });\n\n this.store.subscribe(this.onStoreChange);\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find(m => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"file":"index.js"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.5.0",
6
+ "version": "2.5.1",
7
7
  "description": "Graphing components",
8
8
  "keywords": [
9
9
  "react",
@@ -43,6 +43,6 @@
43
43
  "peerDependencies": {
44
44
  "react": "^16.8.1"
45
45
  },
46
- "gitHead": "087c2d35cb14814526bbaa0cf6744c02ae4b1c5e",
46
+ "gitHead": "0ab3beb8351feafa08845f0c0639fb9a64e10e9a",
47
47
  "scripts": {}
48
48
  }
@@ -41,18 +41,10 @@ class Root extends React.Component {
41
41
  this.store.subscribe(this.onStoreChange);
42
42
  }
43
43
 
44
- componentDidUpdate() {
45
- const { marks } = this.props;
46
- const storeState = this.store.getState();
47
-
48
- if (!isEqual(storeState.marks.present, marks)) {
49
- this.store.dispatch(changeMarks(marks));
50
- }
51
- }
52
-
53
44
  onStoreChange = () => {
54
45
  const { marks, onChangeMarks } = this.props;
55
46
  const storeState = this.store.getState();
47
+
56
48
  if (!isEqual(storeState.marks.present, marks)) {
57
49
  onChangeMarks(storeState.marks.present);
58
50
  }