-
Notifications
You must be signed in to change notification settings - Fork 133
StrictMode in react 18 provoke infinite loop when using @react-keycloak/web #182
Comments
This also happens when only using |
Same. Thanks for posting this issue. |
Same here. Thanks for posting. As a work around I put |
Same here |
same here |
Same here @panz3r |
Even this dosen't works for me |
same here |
Thanks @parweb |
remove the strictMode work for me |
Anyone have any luck other than removing |
I agree that it's not great to move
|
Make sure to remove StrictMode from index.js after moving it to App - then it works fine. |
Same here. @sandrooco thanks for posting this workaround! |
This is happening to me now when my react page is running on localhost:3000 and keyclock is on atcom-cc |
Thats because React's StrictMode is only applicable when your application |
yup, removed StrictMode and it is working fine |
Any ETA for a fix? |
Yes, removed StrictMode and everything is working fine. Thanks @parweb |
from my point of view, removing StrictMode is a only a workaround. I studied the page reactwg/react-18#18 and the fix, that we need for this library is described at the headline "Effects that should only run once can use a ref." Basically, the keycloak initialization process has be independent from mounting or unmounting. When |
Thank you. This works fine for me. |
Is this the fix we need? keycloak/keycloak#12745 |
@nonameolsson no this is not a problem of keycloak-js package, it's a react issue as described above. |
Should we read this as "we bail out of supporting React 18 and further updates"? Apparently, it is well documented and described, why exactly React does this in strict mode, and why libraries should support this behavior. |
Moving <React.StrictMode> and everything inside "ReactKeycloakProvider" saved my life. |
I think that's a misunderstanding. @mwiede meant that the fix mentioned by @nonameolsson does NOT fix this issue here. I believe he did NOT mean to say that this issue is not fixable within react-keycloak. |
My solution: I removed react-keycloak and just used keycloak-js. It's easy and fast to setup. |
this save my life too #savemylife . |
I had the same issue with NextJS since I planned to use |
Hello. |
Next.js These are industry standard these days. Unfortunately, the choice for Keycloak has been locked in from higher up. If it were up to me I would use something that works and gets updated. Just another way to say this bug cost me way too much time and it could have been fixed almost 12 months ago. |
@ziiw do you have an example of that? I will probably have it figured out by the time you are able to reply but for future search engine users it might be useful. |
@ThaJay This isn't how open source works. Why didn't you fixed the bug? You can even hire some one and save money. |
@Bessonov Yes I was a bit worked up yesterday. Regardless, I would expect the Keycloak people to maintain this and not leave it to "the community". |
Hi everyone! I'm facing infinite redirects after login. I'm using react 18, and I'm trying to deploy my app on azure static web app. On localhost everything works. |
Hi @jare25, |
@jare25 StrictMode is only relevant in development mode. Are you not deploying a production build? |
Hi all. I tried with StrictMode inside ReactKeycloakProvide, without StrictMode... I think that I did not configured staticwebsites.config.json (azure static web sites) as expected. I'm searching everywhere, but it seams that I'm only one who is trying to deploy @react-keycloak/web on azure... Thanks for responding! |
Same issue here. |
You can fix it by placing the Strict mode INSIDE the provider. |
I've just upgraded to react 18
after that the app continuously redirect to keycloak server then back to react then keycloak server (infinite loop)
so I debug this behavior
and when I remove react StrictMode all behave as intended
The text was updated successfully, but these errors were encountered: