Skip to content

Commit

Permalink
Update create-browser-router.md (#11508)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophP committed Apr 29, 2024
1 parent eca6c0c commit 2c8d437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions contributors.yml
Expand Up @@ -258,6 +258,7 @@
- xavier-lc
- xcsnowcity
- yionr
- ChristophP
- yracnet
- yuleicul
- zheng-chuang
6 changes: 3 additions & 3 deletions docs/routers/create-browser-router.md
Expand Up @@ -297,14 +297,14 @@ const routes [
];

let router = createBrowserRouter(routes, {
unstable_dataStrategy({ request, params, matches }) {
async unstable_dataStrategy({ request, params, matches }) {
// Run middleware sequentially and let them add data to `context`
let context = {};
for (match of matches) {
for (const match of matches) {
if (match.route.handle?.middleware) {
await match.route.handle.middleware({ request, params }, context);
}
});
}

// Run loaders in parallel with the `context` value
return Promise.all(
Expand Down

0 comments on commit 2c8d437

Please sign in to comment.