Skip to content

Reset error boundaries and rerender server component #45829

Answered by icyJoseph
denisso asked this question in Help
Discussion options

You must be logged in to vote

Since the new Router is coupled to React (concurrent features included) fully, I think that calling router.push and refresh are batching React updates.

It is a bit complex what's going on there, but I think you gotta tell React that reseting the UI, using .push, .refresh is a more important update than reset, but all must be executed anyway.

So you can do that with startTransition:

            const url = new URL(window.location.href);
            router.push(url.origin + url.pathname);
            router.refresh(); 
            startTransition(() => reset());

Where startTransition comes from React:

import { startTransition } from 'react';

Since this is technology in beta state I haven't …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by denisso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants