You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It allows for batchRouter to completely replace original router for changing URL.
It is also needed because when changing pathname via router and changing query via batchRouter happens simultaneously, query change might overwrite pathname change resulting in unwanted behavior.
When pathname is changed, query change requests must be ignored. This is because query change request in that page intends the change in that page, but the page itself will be replaced so query param must be cleared.
However, query param in the same call as the pathname change must be applied to the URL.
Therefore, if pathname change is requested to the batchRouter, it will pass it to the original router, and set a flag to ignore all query change requests. After the pathname change, the flag must be removed.
One example that would require this behavior, is when one useEffect checks the cookie to see if the user has signed in, and redirect to signin page if not. And another useEffect might try to set a query parameter in the URL as a default value.
It will call router.push multiple times, resulting in overwritten URL state.
The text was updated successfully, but these errors were encountered:
It allows for
batchRouter
to completely replace original router for changing URL.It is also needed because when changing pathname via
router
and changing query viabatchRouter
happens simultaneously, query change might overwrite pathname change resulting in unwanted behavior.When pathname is changed, query change requests must be ignored. This is because query change request in that page intends the change in that page, but the page itself will be replaced so query param must be cleared.
However, query param in the same call as the pathname change must be applied to the URL.
Therefore, if pathname change is requested to the
batchRouter
, it will pass it to the original router, and set a flag to ignore all query change requests. After the pathname change, the flag must be removed.One example that would require this behavior, is when one
useEffect
checks the cookie to see if the user has signed in, and redirect to signin page if not. And anotheruseEffect
might try to set a query parameter in the URL as a default value.It will call router.push multiple times, resulting in overwritten URL state.
The text was updated successfully, but these errors were encountered: