@lolyjs/core 0.2.0-alpha.4 → 0.2.0-alpha.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/dist/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -1
- 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 +38 -3
package/dist/index.js
CHANGED
|
@@ -5720,6 +5720,28 @@ function AppShell({
|
|
|
5720
5720
|
window.removeEventListener("popstate", handlePopState, false);
|
|
5721
5721
|
};
|
|
5722
5722
|
}, []);
|
|
5723
|
+
useEffect(() => {
|
|
5724
|
+
const handleDataRefresh = () => {
|
|
5725
|
+
const freshData = window?.__FW_DATA__;
|
|
5726
|
+
if (!freshData) return;
|
|
5727
|
+
const currentPathname = window.location.pathname;
|
|
5728
|
+
const freshPathname = freshData.pathname;
|
|
5729
|
+
if (freshPathname === currentPathname) {
|
|
5730
|
+
if (freshData.metadata !== void 0) {
|
|
5731
|
+
applyMetadata(freshData.metadata);
|
|
5732
|
+
}
|
|
5733
|
+
setState((prevState) => ({
|
|
5734
|
+
...prevState,
|
|
5735
|
+
props: freshData.props ?? prevState.props,
|
|
5736
|
+
params: freshData.params ?? prevState.params
|
|
5737
|
+
}));
|
|
5738
|
+
}
|
|
5739
|
+
};
|
|
5740
|
+
window.addEventListener("fw-data-refresh", handleDataRefresh);
|
|
5741
|
+
return () => {
|
|
5742
|
+
window.removeEventListener("fw-data-refresh", handleDataRefresh);
|
|
5743
|
+
};
|
|
5744
|
+
}, [state.url]);
|
|
5723
5745
|
const isError = state.route === errorRoute;
|
|
5724
5746
|
const isNotFound = state.route === notFoundRoute;
|
|
5725
5747
|
const routeType = isError ? "error" : isNotFound ? "notfound" : "normal";
|
|
@@ -5872,7 +5894,6 @@ function bootstrapClient(routes, notFoundRoute, errorRoute = null) {
|
|
|
5872
5894
|
function withCache(fn, options) {
|
|
5873
5895
|
const ttl = options.ttl ?? 60;
|
|
5874
5896
|
return async function cachedGssp(ctx) {
|
|
5875
|
-
console.log("TTL", ttl);
|
|
5876
5897
|
return await fn(ctx);
|
|
5877
5898
|
};
|
|
5878
5899
|
}
|