-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Bug]: v6.12.1 Navigating and changing pages does not work. No errors in console #10579
Comments
+1 with React 18
|
+1 with React 18 Try the following example, 'useNavigate' doesn't work |
got same behavior after upgrading to 6.12.1. |
+1 It works fine in development mode but doesn't work in production. Environment:
|
Downgrading react-router-dom to v6.21.0 helps. Did not have to downgrade react-router. |
Same problem — in my existing project everything worked fine with
|
Yeah, same here, in prod "react": "18.2.0", after upgrade to "react-router-dom": "6.12.1" all navigation got broken: router just ignores any navigate actions, but URI in browser changes. Downgrade to 6.11.2 fixes the issue. For dev enviroment everything is working fine, which is weird. |
Same here holy it seems something has been broken |
Same here.react in 18.2.0 and react-router-dom in 6.12.0. In development mode it works ok, but in production when hash change, page doesn’t render. And downgrade works for me, |
Looking into the reproduction in #10579 (comment), I believe the root cause in that example seems to be calling Lifting those Does anyone else have an alternate reproduction we could look into to see if there is a core issue with how we're using In some cases, we think that built-in React behavior might be the source of confusion in that with transitions they don't re-show already resolved Suspense boundaries, so in some cases you can also add a |
@brophdawg11 While the new React docs say indeed that |
I agree - this is why I'm asking for more reproductions. That will give is a more complete picture of the ways folks in which are using Suspense features today that don't play nice with Is calling |
Yeap. I currently use it this way in my library I rely upon across my projects. Funny thing, when I wrote that code, I even left a comment for future myself, that I wasn't sure, from React docs, whether such usage is permitted; but in practice it caused me no troubles till now, so I never revised it. |
In the same boat here, 6.12.0 works, 6.12.1 breaks. |
Huh, any chance that's a typo and supposed to say |
Funnily enough, no. I've spent 2 hours yesterday trying to comprehend how a change from a string to a constant would have the ability to break anything. Sites load, the initial page you loud routes correctly, but clicking any link just changes the address bar and doesn't load the actual page/content. |
I can confirm that 6.12.1 is the issue on my end as well. 6.12.0 works fine. I can help investigate but not before Tuesday sadly. |
React We don't use |
That is ... surprising that the While we dig into the underlying React behavior a bit here, if you're running into this, it's best to stay on 6.11 for a bit longer. So far it seems like this is a bit of a case of the fact that Suspense has been "released" for some time but not fully understood (by us included!) so we're sort of "holding it wrong" in some cases. Now that Suspense is a bit better documented/supported/understood, we're seeing If you want to try to get your current app working in the interim (and better prepare your code for a fully-concurrent/transition-enabled world):
We'll keep digging into these reproductions and figure out the best path forward. Sorry for the hiccup! |
I haven't updated react-router-dom since v6.8.2 and it suddenly had this problem. |
@Doridian Are there any specific links that fail for you? I cloned your site and ran the |
For me the issue is on the same route with changed parameters.
E.g., /article/1 vs /article/2
…On Fri, Jun 9, 2023, 23:32 Matt Brophy ***@***.***> wrote:
@Doridian <https://github.com/Doridian> Are there any specific links that
fail for you? I cloned your site and ran the /frontend app in both dev
and prod (with a stubbed window.FOXCAVES_CONFIG) mode and didn't have any
issues routing between the homepage and /login and /register
—
Reply to this email directly, view it on GitHub
<#10579 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQAJM5V3BAEWZG7HEX7WTXKOB7XANCNFSM6AAAAAAZAFNJQY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@brophdawg11 Dev mode navigation works. For me navigation only breaks (but reliably so) in a production build. |
Interestingly, this only happens with code minifcation enabled. I wonder if this hit a bug in the minifier webpack uses? |
Looking at the minified code portion of the [...]
const _ = 'startTransition';
function w(e) {
let { basename: t, children: s, window: l } = e,
u = o.useRef();
null == u.current && (u.current = (0, i.lX)({ window: l, v5Compat: !0 }));
let c = u.current,
[d, f] = o.useState({ action: c.action, location: c.location }),
p = o.useCallback(
(e) => {
_ in (r || (r = n.t(o, 2))) || f(e);
},
[...] It is quite hard to read anything in the minified stuff, but it almost seems as if it misinterprets the |
We just released
Please 👍 this comment if you can confirm this resolves your issue, or let us know if you run into any issues. Assuming nothing comes up we'll aim to have a |
Would it be possible going forward to release a revert patch when a bug is confirmed so that repositories with Dependabot enabled wouldn't accidentally merge the bug? |
I am also facing the same Problem yesterday, Earlier it was working good. Yesterday I Found out that my routes are not working properly in production mode but its working good in development mode. It was a strange behaviour. After reading the above thread & spent couple of hours on this, I concluded that you can resolve this "route change but not rendering view" issue from 2 ways.
Thanks! |
|
quick fix is to freeze the version: |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Hey folks, this should now be resolved in As a reminder we would recommend you pin your dependencies in |
Release 6.12.1 didn't work for many folks (as this issue demonstrates). Release 6.13.0 fixes things, but the release notes for that state:
Can someone provide guidance on the "incompatible" ways some of us may be using It would be good to get some guidance on how we can remedy our code to use |
Keep reading further in the release notes 😉
Notice how in the example you link to in the repo, Another thing to keep in mind is the
|
Thank you very much for the detailed reply @brophdawg11 |
I'm seeing this in 6.14.1, but not in 6.13.0. |
@sethlivingston would you mind opening a new issue with reproduction steps? |
This issue is still reproduced in version 6.15.0. export default function Redirect({ to }: RedirectProps): JSX.Element {
const params = useParams()
const { search } = useLocation()
const navigate = useNavigate()
useEffect(() => {
navigate(
{
pathname: generatePath(to, params),
search,
},
{ replace: true }
)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return null
} |
@siosio34 would you mind opening a new issue with a minimal reproduction? |
We've reproduced this in version function Hook (){
const navigate = useNavigate();
const longTask = async () => {
// await 5 second long task
navigate("/link"); // does nothing
};
return <button onClick={longTask}>Task</button>;
} |
Come on folks, I really don't know how to say this any clearer. Please do not comment on this closed issue with new problems. Please open a new issue with a reproduction in codesandbox, stackblitz, or a github repo. You can link to this issue from the new issue if you think it's a regression of the same type of issue. |
I know that there is a request to don't reply in this thread, but for everyone like me who struggle with these errors, and don't see any solution on the internet, try to test your code without StrictMode. |
What version of React Router are you using?
6.12.1
Steps to Reproduce
I am encountering an issue in my React 18 environment where the setStateImpl method is not being called. I have thoroughly reviewed my code and ensured that I am using React version 18. However, despite my expectations, the setStateImpl method does not seem to be invoked.
Expected Behavior
I expect the setStateImpl method to be called and perform the state update as intended.
Actual Behavior
I am facing an issue after upgrading my environment to React 18 and react-router-dom v6.12.1. Initially, my pages were rendered correctly when I was using react-router-dom v6.10.0. However, after upgrading to v6.12.1, I encountered a white screen issue. Upon debugging the code in the browser console, I noticed that the setStateImpl method is not being called at the specific location within the RouterProvider component in react-router/lib/component.ts, which is causing the white screen to appear.
The text was updated successfully, but these errors were encountered: