Skip to content

Commit 57dd835

Browse files
committed
fix(webapp): revalidate Models loader on project/env path change
1 parent 5e36725 commit 57dd835

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.models._index

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.models._index/route.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,19 @@ export function shouldRevalidate({
176176
defaultShouldRevalidate,
177177
}: ShouldRevalidateFunctionArgs) {
178178
// The active tab is persisted in the URL (?tab=), but no loader data depends
179-
// on it — so switching tabs must not refetch. Any other param change (period,
180-
// from/to, …) revalidates as normal.
179+
// on it — so switching tabs must not refetch. Any other change (a different
180+
// project/environment in the path, or a period/from/to param) revalidates as
181+
// normal, since the loader data is scoped to the path params + time range.
181182
const normalize = (url: URL) => {
182183
const params = new URLSearchParams(url.search);
183184
params.delete("tab");
184185
params.sort();
185186
return params.toString();
186187
};
187-
if (normalize(currentUrl) === normalize(nextUrl)) {
188+
if (
189+
currentUrl.pathname === nextUrl.pathname &&
190+
normalize(currentUrl) === normalize(nextUrl)
191+
) {
188192
return false;
189193
}
190194
return defaultShouldRevalidate;

0 commit comments

Comments
 (0)