@lolyjs/core 0.2.0-alpha.4 → 0.2.0-alpha.5
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/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/react/cache.cjs +25 -0
- package/dist/react/cache.cjs.map +1 -1
- package/dist/react/cache.js +25 -0
- package/dist/react/cache.js.map +1 -1
- package/dist/react/components.cjs.map +1 -1
- package/dist/react/components.js.map +1 -1
- package/dist/react/hooks.cjs.map +1 -1
- package/dist/react/hooks.d.mts +1 -1
- package/dist/react/hooks.d.ts +1 -1
- package/dist/react/hooks.js.map +1 -1
- package/dist/runtime.cjs +22 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +22 -0
- package/dist/runtime.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -5762,6 +5762,28 @@ function AppShell({
|
|
|
5762
5762
|
window.removeEventListener("popstate", handlePopState, false);
|
|
5763
5763
|
};
|
|
5764
5764
|
}, []);
|
|
5765
|
+
(0, import_react3.useEffect)(() => {
|
|
5766
|
+
const handleDataRefresh = () => {
|
|
5767
|
+
const freshData = window?.__FW_DATA__;
|
|
5768
|
+
if (!freshData) return;
|
|
5769
|
+
const currentPathname = window.location.pathname;
|
|
5770
|
+
const freshPathname = freshData.pathname;
|
|
5771
|
+
if (freshPathname === currentPathname) {
|
|
5772
|
+
if (freshData.metadata !== void 0) {
|
|
5773
|
+
applyMetadata(freshData.metadata);
|
|
5774
|
+
}
|
|
5775
|
+
setState((prevState) => ({
|
|
5776
|
+
...prevState,
|
|
5777
|
+
props: freshData.props ?? prevState.props,
|
|
5778
|
+
params: freshData.params ?? prevState.params
|
|
5779
|
+
}));
|
|
5780
|
+
}
|
|
5781
|
+
};
|
|
5782
|
+
window.addEventListener("fw-data-refresh", handleDataRefresh);
|
|
5783
|
+
return () => {
|
|
5784
|
+
window.removeEventListener("fw-data-refresh", handleDataRefresh);
|
|
5785
|
+
};
|
|
5786
|
+
}, [state.url]);
|
|
5765
5787
|
const isError = state.route === errorRoute;
|
|
5766
5788
|
const isNotFound = state.route === notFoundRoute;
|
|
5767
5789
|
const routeType = isError ? "error" : isNotFound ? "notfound" : "normal";
|