[PR #1058] [MERGED] refactor(routing): dedupe param decoding into shared helper #1056

Closed
opened 2026-05-06 13:11:46 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/1058
Author: @james-elicx
Created: 5/4/2026
Status: Merged
Merged: 5/4/2026
Merged by: @james-elicx

Base: mainHead: fix/dedupe-decode-params


📝 Commits (1)

  • db2204e refactor(routing): dedupe param decoding into shared helper

📊 Changes

3 files changed (+31 additions, -40 deletions)

View changed files

📝 packages/vinext/src/routing/route-pattern.ts (+3 -20)
📝 packages/vinext/src/routing/route-trie.ts (+3 -20)
📝 packages/vinext/src/routing/utils.ts (+25 -0)

📄 Description

Summary

  • Extract the identical decodeParam/decodeParams and decodePatternParam/decodePatternParams helpers from route-trie.ts and route-pattern.ts into a single decodeMatchedParams in routing/utils.ts.
  • Both call sites (trieMatch, matchRoutePattern) now share the same implementation.

Context

Follows up on review feedback from #1049:

decodeParam/decodeParams in route-trie.ts and decodePatternParam/decodePatternParams in route-pattern.ts are identical. Suggested extracting to a shared helper in routing/utils.ts.

Pure refactor — no behavior change. The shared helper preserves the same try/catch fallback for malformed escapes and the same in-place mutation semantics.

Test plan

  • vp test run tests/route-trie.test.ts tests/route-pattern.test.ts — 73 tests pass
  • vp test run tests/routing.test.ts tests/route-sorting.test.ts tests/app-router.test.ts tests/pages-router.test.ts — all 716 routing-adjacent tests pass
  • vp fmt --check on touched files — clean

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/1058 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 5/4/2026 **Status:** ✅ Merged **Merged:** 5/4/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/dedupe-decode-params` --- ### 📝 Commits (1) - [`db2204e`](https://github.com/cloudflare/vinext/commit/db2204e67b76459b3724a28d50dd4df7c62a86a4) refactor(routing): dedupe param decoding into shared helper ### 📊 Changes **3 files changed** (+31 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/routing/route-pattern.ts` (+3 -20) 📝 `packages/vinext/src/routing/route-trie.ts` (+3 -20) 📝 `packages/vinext/src/routing/utils.ts` (+25 -0) </details> ### 📄 Description ## Summary - Extract the identical `decodeParam`/`decodeParams` and `decodePatternParam`/`decodePatternParams` helpers from `route-trie.ts` and `route-pattern.ts` into a single `decodeMatchedParams` in `routing/utils.ts`. - Both call sites (`trieMatch`, `matchRoutePattern`) now share the same implementation. ## Context Follows up on review feedback from [#1049](https://github.com/cloudflare/vinext/pull/1049): > `decodeParam`/`decodeParams` in `route-trie.ts` and `decodePatternParam`/`decodePatternParams` in `route-pattern.ts` are identical. Suggested extracting to a shared helper in `routing/utils.ts`. Pure refactor — no behavior change. The shared helper preserves the same try/catch fallback for malformed escapes and the same in-place mutation semantics. ## Test plan - [x] `vp test run tests/route-trie.test.ts tests/route-pattern.test.ts` — 73 tests pass - [x] `vp test run tests/routing.test.ts tests/route-sorting.test.ts tests/app-router.test.ts tests/pages-router.test.ts` — all 716 routing-adjacent tests pass - [x] `vp fmt --check` on touched files — clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:46 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#1056
No description provided.