Skip to content

getToken changes after each render #201

@marjan-pluto

Description

@marjan-pluto

Package + Version

  • @clerk/clerk-js
  • @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:
image

A workaround is to remove it from the dependancy array, however that does not make eslint happy
image

It would be ideal if getToken can be made stable as it was in v2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions