-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sagaRouter): upgrade
path-to-regexp
(#5480)
- Loading branch information
Showing
8 changed files
with
262 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
'@talend/react-cmf-router': major | ||
'@talend/react-cmf': major | ||
--- | ||
|
||
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. | ||
|
||
2. 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: | ||
```javascript | ||
// 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](https://github.com/pillarjs/path-to-regexp#errors). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.