@admin-layout/client 10.1.1-alpha.12 → 10.1.1-alpha.21

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.
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAK/C,UAAU,yBAAyB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,YAAY,CAkBhG"}
1
+ {"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,UAAU,yBAAyB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,YAAY,CA0BhG"}
@@ -1,16 +1,24 @@
1
- import {jsx,Fragment}from'react/jsx-runtime';import {useLoaderData}from'@remix-run/react';import {useLayoutEffect}from'react';import {useDispatch}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';function LayoutCookieProvider({ children }) {
1
+ import {jsx,Fragment}from'react/jsx-runtime';import {useLoaderData}from'@remix-run/react';import {useRef,useEffect}from'react';import {useDispatch}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';function LayoutCookieProvider({ children }) {
2
2
  const { settings } = useLoaderData();
3
3
  const dispatch = useDispatch();
4
- const changeSettings = () => {
5
- if (settings) {
4
+ const hasDispatched = useRef(false);
5
+ // Handle both server and client side
6
+ useEffect(() => {
7
+ if (settings && !hasDispatched.current) {
6
8
  dispatch({
7
9
  type: CHANGE_SETTINGS_ACTION,
8
10
  payload: settings,
9
11
  });
12
+ hasDispatched.current = true;
10
13
  }
11
- };
12
- useLayoutEffect(() => {
13
- changeSettings();
14
14
  }, [settings, dispatch]);
15
+ // Initial server-side dispatch
16
+ if (typeof window === 'undefined' && settings && !hasDispatched.current) {
17
+ dispatch({
18
+ type: CHANGE_SETTINGS_ACTION,
19
+ payload: settings,
20
+ });
21
+ hasDispatched.current = true;
22
+ }
15
23
  return jsx(Fragment, { children: children });
16
24
  }export{LayoutCookieProvider};//# sourceMappingURL=LayoutCookieProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutCookieProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LayoutCookieProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/client",
3
- "version": "10.1.1-alpha.12",
3
+ "version": "10.1.1-alpha.21",
4
4
  "description": "Sample client for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -23,7 +23,7 @@
23
23
  "watch": "yarn build:lib:watch"
24
24
  },
25
25
  "dependencies": {
26
- "@common-stack/client-core": "7.1.1-alpha.14",
26
+ "@common-stack/client-core": "7.1.1-alpha.29",
27
27
  "common": "10.1.1-alpha.0",
28
28
  "serialize-error": "^8.0.0"
29
29
  },
@@ -40,5 +40,5 @@
40
40
  "typescript": {
41
41
  "definition": "lib/index.d.ts"
42
42
  },
43
- "gitHead": "8d785a09b1176c5eaf5d88196d178d7edb452522"
43
+ "gitHead": "fd950a4fa0ad32d54b8017ce0ab23778a2666d5e"
44
44
  }