Skip to content

Commit eada1fe

Browse files
committed
remove buggy cache
1 parent 4f3d13c commit eada1fe

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

router/index.tsx

+3-10
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ const match = globalX.__ROUTES__
2020
? getRouteMatcher(globalX.__ROUTES__)
2121
: () => null;
2222

23-
const cache = new Map<string, any>();
24-
25-
async function cachedFetchServerSideProps(pathname: string) {
26-
if (cache.has(pathname)) {
27-
return cache.get(pathname);
28-
}
23+
async function fetchServerSideProps(pathname: string) {
2924
const response = await fetch(pathname, {
3025
method: "POST",
3126
headers: {
@@ -35,9 +30,7 @@ async function cachedFetchServerSideProps(pathname: string) {
3530
});
3631
if (response.ok) {
3732
const text = await response.text();
38-
const props = eval(`(${text})`);
39-
cache.set(pathname, props);
40-
return props;
33+
return eval(`(${text})`);
4134
}
4235
throw new Error("Failed to fetch");
4336
}
@@ -61,7 +54,7 @@ export const RouterHost = ({
6154
const currentVersion = ++version.current;
6255
const [module, props] = await Promise.all([
6356
import(match(pathname.split("?")[0])!.value),
64-
cachedFetchServerSideProps(pathname),
57+
fetchServerSideProps(pathname),
6558
]);
6659
if (currentVersion === version.current) {
6760
if (props?.redirect) {

0 commit comments

Comments
 (0)