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