<!-- Requirements: please go through this checklist before opening a new issue --> - [X] Review the documentation: https://docs.clerk.dev/ - [X] Search for existing issues: https://github.com/clerkinc/javascript/issues - [X] Go through package changelog files. - [ ] Provide the Frontend API key from your application dashboard. <!-- You can also find us on Discord https://discord.com/invite/b5rXHjAg7A --> ## Package + Version - [ ] `@clerk/clerk-js` - [X] `@clerk/clerk-react` - [ ] `@clerk/nextjs` - [ ] `@clerk/remix` - [ ] `@clerk/clerk-expo` - [ ] `@clerk/backend-core` - [ ] `@clerk/clerk-sdk-node` - [ ] `@clerk/edge` - [ ] other: ### Version: ``` ^3.2.7 ``` ### Browser/OS `Chrome latest` ## Description We started migrating to v3 and noticed `getToken` from `useAuth` function identity is not stable and as a result changes after each re-render. This causes the the app to go into infinite loop when `getToken` is used in the dependancy array of something like `useEffect`. Usage Snippet: <img width="620" alt="image" src="https://user-images.githubusercontent.com/97608659/163834327-9a5940a2-b318-4c21-8cfe-badebf2d0817.png"> A workaround is to remove it from the dependancy array, however that does not make eslint happy <img width="618" alt="image" src="https://user-images.githubusercontent.com/97608659/163834611-34590203-bbce-46c1-bd85-153a382039b7.png"> It would be ideal if `getToken` can be made stable as it was in v2.
Activity
nikosdouvlis commentedon Apr 29, 2022
Hello @marjan-pluto ! Many thanks for reporting this one :)
getTokendoesn't need to be in the dependency array, but I can see why this is problematic. Your comment about eslint makes perfect sense.I'll be working on this during the next few days, and I'll ping you here when we push a fix. Thanks again!
waldothedeveloper commentedon Feb 22, 2023
if
getTokenis not needed, update the docs folks until this is resolved...I was trying tosetStatefollowing the example from the docs below and I was getting an infinite loop because of thegetToken...https://clerk.dev/docs/integration/firebase#:~:text=29-,%7D%2C%20%5BgetToken%5D)%3B,-30
dimkl commentedon Feb 28, 2023
@waldothedeveloper thank you for reporting it. We have updated our docs.
rjdellecese commentedon Feb 28, 2023
The problem described by this issue hasn't been resolved, has it? If not, it seems to me like this issue should remain open.
nikosdouvlis commentedon Mar 24, 2023
Hello everyone, the fix will be shipped with our next release.