Skip to content

Commit a3788d8

Browse files
committed
fix(): refine incremental rendering: ignore checking numeric parent route params
1 parent 4506eb5 commit a3788d8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

packages/runtime/src/internal/Renderer.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { isTrackAll } from "@next-core/cook";
2121
import { hasOwnProperty } from "@next-core/utils/general";
2222
import { strictCollectMemberUsage } from "@next-core/utils/storyboard";
23-
import { debounce, isEqual } from "lodash";
23+
import { debounce, isEqual, omitBy } from "lodash";
2424
import { asyncCheckBrickIf } from "./compute/checkIf.js";
2525
import {
2626
asyncComputeRealPropertyEntries,
@@ -940,7 +940,7 @@ async function legacyRenderBrick(
940940
)) &&
941941
(newMatch = matchRoute(route, homepage, pathname)) &&
942942
(route !== parentRoute ||
943-
isEqual(prevMatch.params, newMatch.params))
943+
isRouteParamsEqual(prevMatch.params, newMatch.params))
944944
);
945945
})
946946
) {
@@ -1343,3 +1343,18 @@ function catchLoad(
13431343
})
13441344
: promise;
13451345
}
1346+
1347+
function isRouteParamsEqual(
1348+
a: Record<string, string>,
1349+
b: Record<string, string>
1350+
) {
1351+
if (isEqual(a, b)) {
1352+
return true;
1353+
}
1354+
const omitNumericKeys = (v: unknown, k: string) => {
1355+
return String(Number(k)) === k;
1356+
};
1357+
const c = omitBy(a, omitNumericKeys);
1358+
const d = omitBy(b, omitNumericKeys);
1359+
return isEqual(c, d);
1360+
}

0 commit comments

Comments
 (0)