react-toolkits 2.13.5 → 2.13.6

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
@@ -1,5 +1,11 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.13.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 3b3beba: fix: should merge parent state correctly
8
+
3
9
  ## 2.13.5
4
10
 
5
11
  ### Patch Changes
package/lib/index.js CHANGED
@@ -378,7 +378,7 @@ function useToolkitsStore(selector) {
378
378
  if (!store) throw new Error("Missing ToolkitsProvider in the tree");
379
379
  return useStore(store, selector);
380
380
  }
381
- var ToolkitsContext, globalState, ToolkitsProvider, withContext, ToolkitsProvider_default;
381
+ var ToolkitsContext, ToolkitsProvider, withContext, ToolkitsProvider_default;
382
382
  var init_ToolkitsProvider = __esm({
383
383
  "src/components/toolkitsProvider/ToolkitsProvider.tsx"() {
384
384
  init_stores();
@@ -387,14 +387,14 @@ var init_ToolkitsProvider = __esm({
387
387
  ToolkitsProvider = (props) => {
388
388
  const { children, ...restProps } = props;
389
389
  const storeRef = useRef();
390
+ const parentState = useContext(ToolkitsContext)?.getState();
390
391
  if (!storeRef.current) {
391
392
  storeRef.current = createToolkitsStore({
392
- ...globalState,
393
+ ...parentState,
393
394
  ...restProps
394
395
  });
395
396
  }
396
- globalState = storeRef.current.getState();
397
- if (!globalState.signInPath) {
397
+ if (!storeRef.current.getState().signInPath) {
398
398
  throw new Error('ToolkitsProvider: \u8BF7\u914D\u7F6E "signInPath"');
399
399
  }
400
400
  return /* @__PURE__ */ jsx(ToolkitsContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsx(App, { children: /* @__PURE__ */ jsx(Interceptors_default, { children }) }) });