@rangojs/router 0.0.0-experimental.27 → 0.0.0-experimental.28

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.
@@ -1745,7 +1745,7 @@ import { resolve } from "node:path";
1745
1745
  // package.json
1746
1746
  var package_default = {
1747
1747
  name: "@rangojs/router",
1748
- version: "0.0.0-experimental.27",
1748
+ version: "0.0.0-experimental.28",
1749
1749
  description: "Django-inspired RSC router with composable URL patterns",
1750
1750
  keywords: [
1751
1751
  "react",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangojs/router",
3
- "version": "0.0.0-experimental.27",
3
+ "version": "0.0.0-experimental.28",
4
4
  "description": "Django-inspired RSC router with composable URL patterns",
5
5
  "keywords": [
6
6
  "react",
@@ -84,6 +84,7 @@ export async function evaluateRevalidation<TEnv>(
84
84
  } = options;
85
85
  const nextParams = segment.params || {};
86
86
  const paramsChanged = !paramsEqual(nextParams, prevParams);
87
+ const searchChanged = prevUrl.search !== nextUrl.search;
87
88
 
88
89
  // Trace helper: push a structured entry to the request-scoped trace buffer.
89
90
  // Guarded by isTraceActive() so object construction is skipped in production.
@@ -134,25 +135,35 @@ export async function evaluateRevalidation<TEnv>(
134
135
  // Only the route segment revalidates by default - all others require explicit opt-in
135
136
 
136
137
  if (segment.type === "route") {
137
- // Route segments revalidate when params change
138
- // Routes are the primary param-dependent content and always need updates
139
- defaultShouldRevalidate = paramsChanged;
138
+ // Route segments revalidate when path params OR search params change.
139
+ // Search params (e.g., ?page=2&sort=price) are server-parsed via ctx.search,
140
+ // so the handler must re-execute to produce updated content.
141
+ const routeChanged = paramsChanged || searchChanged;
142
+ defaultShouldRevalidate = routeChanged;
140
143
  defaultReason = paramsChanged
141
144
  ? "nav:params-changed"
142
- : "nav:params-unchanged";
143
- if (paramsChanged) {
144
- debugLog("revalidation", "route params changed, revalidating", {
145
+ : searchChanged
146
+ ? "nav:search-changed"
147
+ : "nav:params-unchanged";
148
+ if (routeChanged) {
149
+ debugLog("revalidation", "route revalidating", {
145
150
  segmentId: segment.id,
151
+ paramsChanged,
152
+ searchChanged,
146
153
  });
147
154
  }
148
- } else if (segment.belongsToRoute && paramsChanged) {
155
+ } else if (segment.belongsToRoute && (paramsChanged || searchChanged)) {
149
156
  // Children of the route path (loaders, orphan layouts/parallels)
150
- // revalidate when params change they likely depend on route params
157
+ // revalidate when path params or search params change
151
158
  defaultShouldRevalidate = true;
152
- defaultReason = "nav:route-child-params-changed";
153
- debugLog("revalidation", "route child revalidating (params changed)", {
159
+ defaultReason = paramsChanged
160
+ ? "nav:route-child-params-changed"
161
+ : "nav:route-child-search-changed";
162
+ debugLog("revalidation", "route child revalidating", {
154
163
  segmentId: segment.id,
155
164
  segmentType: segment.type,
165
+ paramsChanged,
166
+ searchChanged,
156
167
  });
157
168
  } else {
158
169
  // Parent layouts and parallels default to no revalidation