I’m currently using the useUser
hook from the Auth0 Next.js SDK in my application. Upon reviewing the SDK’s documentation and source code, I’ve observed that the hook utilizes useSWR
internally to fetch user data from the /auth/profile
endpoint. This setup introduces polling behavior, as useSWR
periodically re-fetches data to keep it up-to-date.
However, the SDK does not provide a direct way to customize the polling behavior via the useUser
hook. I’m seeking guidance on how to manage polling behavior, such as adjusting the refresh interval or disabling polling, to optimize network requests and application performance.
Steps to Reproduce:
-
Install the Auth0 Next.js SDK.
-
Use the
useUser
hook in a component. -
Observe the network requests to the
/auth/profile
endpoint.
Expected Behavior:
The ability to customize the polling behavior of the useUser
hook, including adjusting the refresh interval or disabling polling, to optimize network requests and application performance.
Actual Behavior:
The SDK does not provide a direct way to customize the polling behavior via the useUser
hook.
Environment:
-
Auth0 Next.js SDK version: ^4.9.0
-
Next.js version: 15.5.2
Additional Context:
Customizing the polling behavior is crucial for optimizing network requests and application performance, especially in scenarios where user data changes infrequently. Providing a way to manage polling behavior would enhance the flexibility and efficiency of the SDK.