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

Expose promises from underlying router operations for use in react 19 #11521

Merged
merged 5 commits into from May 9, 2024

Conversation

brophdawg11
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: 81be2c2

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

This PR includes changesets to release 7 packages
Name Type
react-router Major
react-router-dom Major
@react-router/dev Major
@react-router/server-runtime Major
@react-router/node Major
@react-router/express Major
@react-router/serve Major

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

React.useEffect(() => navigate("/with space"), []);
React.useEffect(() => {
navigate("/with space");
}, [navigate]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests needed to be updated so they don't return promises from useEffect

@@ -142,7 +142,6 @@ type SetupOpts = {
initialEntries?: InitialEntry[];
initialIndex?: number;
hydrationData?: HydrationState;
future?: FutureConfig;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must be a duplicate from a merge conflict - we want the partial version below

@@ -1366,7 +1371,7 @@ export function createRouter(init: RouterInit): Router {
return;
}

return await startNavigation(historyAction, nextLocation, {
await startNavigation(historyAction, nextLocation, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open question - what should happen on interrupted navigations? Right now the promise will resolve with undefined when it gets interrupted. I don't think rejecting makes sense since we wouldn't want any error boundaries to trigger...

@brophdawg11 brophdawg11 merged commit 361eb79 into v7 May 9, 2024
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/expose-promises branch May 9, 2024 19:08
@brophdawg11 brophdawg11 linked an issue May 20, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose routing promises
1 participant