Skip to content

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Apr 10, 2025

Add the unstable_runClientMiddleware API to dataStrategy to allow users to run middleware inside of custom dataStrategy implementations

Copy link

changeset-bot bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: 3be00d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines -166 to +177
return runMiddlewarePipeline(
args,
false,
() => singleFetchActionStrategy(args, basename),
handleMiddlewareError
) as Promise<Record<string, DataStrategyResult>>;
return singleFetchActionStrategy(args, basename);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes back to effectively the original non-middleware implementation because we wrap middleware around the whole thing above

basename,
getRouter
);
return async (args) => args.unstable_runMiddleware(dataStrategy);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new runMiddleware API to wrap middleware around our existing dataStrategy - instead of calling middleware independently for each fork in the dataStrategy

@brophdawg11 brophdawg11 force-pushed the brophdawg11/ds-run-middleware branch from 14229eb to cbb9d74 Compare April 10, 2025 15:00
@brophdawg11 brophdawg11 changed the title Add unstable_runMiddleware API for dataStrategy Add unstable_runClientMiddleware API for dataStrategy Apr 10, 2025
@brophdawg11 brophdawg11 merged commit 90695fb into dev Apr 10, 2025
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/ds-run-middleware branch April 10, 2025 17:46
Copy link
Contributor

🤖 Hello there,

We just published version 7.5.1-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 7.5.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant