@tanstack/router-core 1.130.10 → 1.130.12

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.
@@ -1727,15 +1727,20 @@ function routeNeedsPreload(route) {
1727
1727
  const REQUIRED_PARAM_BASE_SCORE = 0.5;
1728
1728
  const OPTIONAL_PARAM_BASE_SCORE = 0.4;
1729
1729
  const WILDCARD_PARAM_BASE_SCORE = 0.25;
1730
+ const BOTH_PRESENCE_BASE_SCORE = 0.05;
1731
+ const PREFIX_PRESENCE_BASE_SCORE = 0.02;
1732
+ const SUFFIX_PRESENCE_BASE_SCORE = 0.01;
1733
+ const PREFIX_LENGTH_SCORE_MULTIPLIER = 2e-4;
1734
+ const SUFFIX_LENGTH_SCORE_MULTIPLIER = 1e-4;
1730
1735
  function handleParam(segment, baseScore) {
1731
1736
  if (segment.prefixSegment && segment.suffixSegment) {
1732
- return baseScore + 0.05;
1737
+ return baseScore + BOTH_PRESENCE_BASE_SCORE + PREFIX_LENGTH_SCORE_MULTIPLIER * segment.prefixSegment.length + SUFFIX_LENGTH_SCORE_MULTIPLIER * segment.suffixSegment.length;
1733
1738
  }
1734
1739
  if (segment.prefixSegment) {
1735
- return baseScore + 0.02;
1740
+ return baseScore + PREFIX_PRESENCE_BASE_SCORE + PREFIX_LENGTH_SCORE_MULTIPLIER * segment.prefixSegment.length;
1736
1741
  }
1737
1742
  if (segment.suffixSegment) {
1738
- return baseScore + 0.01;
1743
+ return baseScore + SUFFIX_PRESENCE_BASE_SCORE + SUFFIX_LENGTH_SCORE_MULTIPLIER * segment.suffixSegment.length;
1739
1744
  }
1740
1745
  return baseScore;
1741
1746
  }