@jsenv/navi 0.16.13 → 0.16.15

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.
@@ -8709,11 +8709,17 @@ const createRoutePattern = (pattern) => {
8709
8709
  }
8710
8710
  // Include parameters that target pattern specifically needs
8711
8711
  if (targetQueryParamNames.has(paramName)) {
8712
- ancestorParams[paramName] = value;
8713
- if (DEBUG$2) {
8714
- console.debug(
8715
- `[${pattern}] tryDirectOptimization: Added target param ${paramName}=${value}`,
8716
- );
8712
+ // Only include if the value is not the default value
8713
+ const connection = targetAncestor.connections.find(
8714
+ (conn) => conn.paramName === paramName,
8715
+ );
8716
+ if (connection && connection.options.defaultValue !== value) {
8717
+ ancestorParams[paramName] = value;
8718
+ if (DEBUG$2) {
8719
+ console.debug(
8720
+ `[${pattern}] tryDirectOptimization: Added target param ${paramName}=${value}`,
8721
+ );
8722
+ }
8717
8723
  }
8718
8724
  }
8719
8725
  // Include source query parameters (these should be inherited during ancestor optimization)
@@ -8745,6 +8751,39 @@ const createRoutePattern = (pattern) => {
8745
8751
  }
8746
8752
  }
8747
8753
 
8754
+ // Also check target ancestor's own signal values for parameters not in resolvedParams
8755
+ for (const connection of targetAncestor.connections) {
8756
+ const { paramName, signal, options } = connection;
8757
+ const defaultValue = options.defaultValue;
8758
+
8759
+ // Only include if not already processed and has non-default value
8760
+ if (
8761
+ !(paramName in ancestorParams) &&
8762
+ signal?.value !== undefined &&
8763
+ signal.value !== defaultValue
8764
+ ) {
8765
+ // Don't include path parameters that correspond to literal segments we're optimizing away
8766
+ const targetParam = targetParams.find((p) => p.name === paramName);
8767
+ const isPathParam = targetParam !== undefined; // Any param in segments is a path param
8768
+ if (isPathParam) {
8769
+ // Skip path parameters - we want them to use default values for optimization
8770
+ if (DEBUG$2) {
8771
+ console.debug(
8772
+ `[${pattern}] tryDirectOptimization: Skipping path param ${paramName}=${signal.value} (will use default)`,
8773
+ );
8774
+ }
8775
+ continue;
8776
+ }
8777
+
8778
+ ancestorParams[paramName] = signal.value;
8779
+ if (DEBUG$2) {
8780
+ console.debug(
8781
+ `[${pattern}] tryDirectOptimization: Added target signal param ${paramName}=${signal.value}`,
8782
+ );
8783
+ }
8784
+ }
8785
+ }
8786
+
8748
8787
  // Then, get all ancestors starting from the target ancestor's parent (skip the target itself)
8749
8788
  const targetAncestorRelationships = patternRelationships.get(
8750
8789
  targetAncestor.originalPattern,
@@ -10807,9 +10846,6 @@ const navTo = (target, options) => {
10807
10846
  }
10808
10847
  return browserIntegration.navTo(url, options);
10809
10848
  };
10810
- const replaceUrl = (target, options = {}) => {
10811
- return navTo(target, { ...options, replace: true });
10812
- };
10813
10849
  const stopLoad = (reason = "stopLoad() called") => {
10814
10850
  const windowIsLoading = windowIsLoadingSignal.value;
10815
10851
  if (windowIsLoading) {
@@ -11195,10 +11231,6 @@ const initRouteObserver = ({
11195
11231
  // ensure we re-render on document url change (useful when navigating from /users/list to /users)
11196
11232
  // so that we re-replace urls back to /users/list when /users/list is an index
11197
11233
  useDocumentUrl();
11198
- if (matchingRouteInfo && matchingRouteInfo.index && !matchingRouteInfo.route.matching) {
11199
- const routeUrl = matchingRouteInfo.route.routeFromProps.buildUrl();
11200
- replaceUrl(routeUrl);
11201
- }
11202
11234
  return jsx(RouteInfoContext.Provider, {
11203
11235
  value: matchingRouteInfo,
11204
11236
  children: jsx(SlotContext.Provider, {