Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sagaRouter): upgrade path-to-regexp #5480

Merged
merged 9 commits into from
Dec 31, 2024

Conversation

yyanwang
Copy link
Member

@yyanwang yyanwang commented Dec 20, 2024

What is the problem this PR is trying to solve?
BREAKING CHANGE: Upgraded path-to-regexp from 3.x to 8.x

This upgrade was necessary to resolve security vulnerabilities. The new version introduces two breaking changes that require updates to your application:

  1. Optional Path Parameter Syntax Change
  • Old syntax: /resources/:id?
  • New syntax: /resources{/id}

This change is required because in path-to-regexp 8.x, the ? character is reserved for query parameters and will throw a parsing error when used at the end of a path.

  1. Root Path Matching Behavior Change
  • In v3.x, root path / would match any path starting with /
  • In v8.x, root path / only matches exactly /
  • To match both root and child paths, use the wildcard pattern /{*path}

Example migration:

// Before
const routes = {
    '/': rootSaga,
    '/resources/:id?': resourceSaga
};

// After
const routes = {
    '/{*path}': rootSaga,  // if you want to match all routes
    '/resources{/id}': resourceSaga
};

For more details about path matching and troubleshooting, see path-to-regexp documentation.

What is the chosen solution to this problem?

Please check if the PR fulfills these requirements

  • The PR have used yarn changeset to a request a release from the CI if wanted.
  • The PR commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features) And non reg done before need review
  • Docs have been added / updated (for bug fixes / features)
  • Related design / discussions / pages (not in jira), if any, are all linked or available in the PR

[ ] This PR introduces a breaking change

Copy link
Contributor

Storybook for this PR deployed on this github page

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Title Lines Statements Branches Functions
assets-api Coverage: 28%
28.4% (25/88) 30.76% (16/52) 21.42% (3/14)
cmf Coverage: 89%
89.36% (1243/1391) 80.93% (607/750) 89.51% (350/391)
cmf-cqrs Coverage: 87%
87.43% (160/183) 70.23% (59/84) 84.21% (48/57)
cmf-router Coverage: 70%
69.23% (135/195) 55.71% (78/140) 56.81% (25/44)
components Coverage: 90%
90.8% (5527/6087) 81.84% (3206/3917) 88.14% (1390/1577)
containers Coverage: 84%
83.59% (1391/1664) 74.3% (694/934) 75% (327/436)
dataviz Coverage: 85%
85.44% (323/378) 66.66% (160/240) 75.79% (119/157)
design-system Coverage: 67%
66.49% (1016/1528) 50.93% (544/1068) 53.94% (219/406)
faceted-search Coverage: 85%
85.08% (639/751) 78.63% (287/365) 81.88% (226/276)
flow-designer Coverage: 70%
70.07% (651/929) 66.72% (355/532) 70.92% (200/282)
forms Coverage: 85%
85.81% (1640/1911) 75.77% (929/1226) 84.24% (460/546)
http Coverage: 100%
100% (85/85) 98.07% (51/52) 100% (34/34)
sagas Coverage: 92%
92.3% (24/26) 66.66% (4/6) 50% (2/4)
stepper Coverage: 80%
81.52% (150/184) 59.34% (54/91) 80.85% (38/47)
utils Coverage: 100%
100% (73/73) 90.9% (10/11) 100% (24/24)

@yyanwang yyanwang changed the title fix(sagaRouter): update DOC and add unit test fix(sagaRouter): optional route parameter Dec 20, 2024
@yyanwang yyanwang changed the title fix(sagaRouter): optional route parameter chore(sagaRouter): optional route parameter Dec 20, 2024
@yyanwang yyanwang changed the title chore(sagaRouter): optional route parameter chore(sagaRouter): upgrade path-to-regexp Dec 24, 2024
@yyanwang yyanwang temporarily deployed to pull_request_unsafe December 24, 2024 10:30 — with GitHub Actions Inactive
@yyanwang yyanwang temporarily deployed to pull_request_unsafe December 25, 2024 02:56 — with GitHub Actions Inactive
@yyanwang yyanwang temporarily deployed to pull_request_unsafe December 30, 2024 02:17 — with GitHub Actions Inactive
@yyanwang yyanwang merged commit 816bb91 into master Dec 31, 2024
8 checks passed
@yyanwang yyanwang deleted the ywang/fix/sagaRouter-optional-path-param branch December 31, 2024 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants