@carbonorm/carbonreact 4.0.0 → 4.0.2

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/dist/index.esm.js CHANGED
@@ -4357,8 +4357,8 @@ function isJsonString(str) {
4357
4357
  }
4358
4358
  return true;
4359
4359
  }
4360
- const persistentStateMap = new Map();
4361
4360
  class CarbonReact extends Component {
4361
+ static persistentStateMap = new Map();
4362
4362
  context = createContext(this.state);
4363
4363
  // Private static member
4364
4364
  // we actually implement this in the constructor todo - test this
@@ -4385,8 +4385,8 @@ class CarbonReact extends Component {
4385
4385
  Object.assign(new.target, {
4386
4386
  instance: this
4387
4387
  });
4388
- if (this.props.instanceId && persistentStateMap.has(this.props.instanceId)) {
4389
- this.state = persistentStateMap.get(this.props.instanceId);
4388
+ if (this.props.instanceId && CarbonReact.persistentStateMap.has(this.props.instanceId)) {
4389
+ this.state = CarbonReact.persistentStateMap.get(this.props.instanceId);
4390
4390
  }
4391
4391
  else {
4392
4392
  // This should only ever be done here, when the full state is being trashed.
@@ -4405,7 +4405,7 @@ class CarbonReact extends Component {
4405
4405
  }
4406
4406
  shouldComponentUpdate(nextProps, nextState, _nextContext) {
4407
4407
  if (this.props.instanceId) {
4408
- persistentStateMap.set(this.props.instanceId, nextState);
4408
+ CarbonReact.persistentStateMap.set(this.props.instanceId, nextState);
4409
4409
  }
4410
4410
  changed(this.constructor.name + ' (C6Api)', 'props', this.props, nextProps);
4411
4411
  changed(this.constructor.name + ' (C6Api)', 'state', this.state, nextState);