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 routing promises #11564

Open
ryanflorence opened this issue May 17, 2024 · 1 comment · Fixed by #11521
Open

Expose routing promises #11564

ryanflorence opened this issue May 17, 2024 · 1 comment · Fixed by #11521
Assignees

Comments

@ryanflorence
Copy link
Member

In order for React Router transitions to compose with React 19 transitions we need to expose the promises from all of our transition functions:

navigate()
submit()
fetcher.submit()
fetcher.load()
revalidator.revalidate()

This way developers can call into React Router from inside a React transition

let [isPending, startTransition] = useTransition()
startTransition(async () => {
  let stuff = await doSomething()
  let more = await fetcher.submit({ stuff }, { method: "post" })
});
@bluefire2121
Copy link

Very cool! I guess you can do this as well.

const [isPending, startTransition] = useTransition()
startTransition(async () => {
  const [more, stuff] = await Promise.all([fetcher.submit({ stuff }, { method: "post" }), doSomething()]);
});

@brophdawg11 brophdawg11 changed the title expose promises Expose routing promises May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Planned
Development

Successfully merging a pull request may close this issue.

3 participants