@carbonorm/carbonreact 4.0.1 → 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/CarbonReact.d.ts +6 -5
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/CarbonReact.tsx +11 -11
package/dist/CarbonReact.d.ts
CHANGED
|
@@ -19,12 +19,13 @@ export declare const initialCarbonReactState: iCarbonReactState & iRestfulObject
|
|
|
19
19
|
export declare function isJsonString(str: string): boolean;
|
|
20
20
|
declare abstract class CarbonReact<P = {}, S extends {
|
|
21
21
|
[key: string]: any;
|
|
22
|
-
} =
|
|
22
|
+
} = typeof initialCarbonReactState> extends Component<{
|
|
23
23
|
children?: ReactNode | ReactNode[];
|
|
24
24
|
instanceId?: string;
|
|
25
25
|
websocket?: Omit<iCarbonWebSocketProps, "instance"> | boolean;
|
|
26
|
-
} & P, S
|
|
27
|
-
|
|
26
|
+
} & P, S> {
|
|
27
|
+
private static persistentStateMap;
|
|
28
|
+
context: Context<S>;
|
|
28
29
|
protected static instance: CarbonReact;
|
|
29
30
|
protected target: typeof CarbonReact;
|
|
30
31
|
protected updateRestfulObjectArrays: <ObjectType extends {
|
|
@@ -40,8 +41,8 @@ declare abstract class CarbonReact<P = {}, S extends {
|
|
|
40
41
|
shouldStatePersist?: boolean | undefined;
|
|
41
42
|
websocket?: boolean | iCarbonWebSocketProps | undefined;
|
|
42
43
|
} & P);
|
|
43
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
44
|
-
componentDidUpdate(_prevProps: Readonly<
|
|
44
|
+
shouldComponentUpdate(nextProps: Readonly<P>, nextState: Readonly<S>, _nextContext: any): boolean;
|
|
45
|
+
componentDidUpdate(_prevProps: Readonly<P>, _prevState: Readonly<S>, _snapshot?: any): void;
|
|
45
46
|
render(): ReactElement;
|
|
46
47
|
}
|
|
47
48
|
export default CarbonReact;
|
package/dist/index.cjs.js
CHANGED
|
@@ -4359,8 +4359,8 @@ function isJsonString(str) {
|
|
|
4359
4359
|
}
|
|
4360
4360
|
return true;
|
|
4361
4361
|
}
|
|
4362
|
-
const persistentStateMap = new Map();
|
|
4363
4362
|
class CarbonReact extends react.Component {
|
|
4363
|
+
static persistentStateMap = new Map();
|
|
4364
4364
|
context = react.createContext(this.state);
|
|
4365
4365
|
// Private static member
|
|
4366
4366
|
// we actually implement this in the constructor todo - test this
|
|
@@ -4387,8 +4387,8 @@ class CarbonReact extends react.Component {
|
|
|
4387
4387
|
Object.assign(new.target, {
|
|
4388
4388
|
instance: this
|
|
4389
4389
|
});
|
|
4390
|
-
if (this.props.instanceId && persistentStateMap.has(this.props.instanceId)) {
|
|
4391
|
-
this.state = persistentStateMap.get(this.props.instanceId);
|
|
4390
|
+
if (this.props.instanceId && CarbonReact.persistentStateMap.has(this.props.instanceId)) {
|
|
4391
|
+
this.state = CarbonReact.persistentStateMap.get(this.props.instanceId);
|
|
4392
4392
|
}
|
|
4393
4393
|
else {
|
|
4394
4394
|
// This should only ever be done here, when the full state is being trashed.
|
|
@@ -4407,7 +4407,7 @@ class CarbonReact extends react.Component {
|
|
|
4407
4407
|
}
|
|
4408
4408
|
shouldComponentUpdate(nextProps, nextState, _nextContext) {
|
|
4409
4409
|
if (this.props.instanceId) {
|
|
4410
|
-
persistentStateMap.set(this.props.instanceId, nextState);
|
|
4410
|
+
CarbonReact.persistentStateMap.set(this.props.instanceId, nextState);
|
|
4411
4411
|
}
|
|
4412
4412
|
changed(this.constructor.name + ' (C6Api)', 'props', this.props, nextProps);
|
|
4413
4413
|
changed(this.constructor.name + ' (C6Api)', 'state', this.state, nextState);
|