Hi we are noticing that /refresh is being called c...
# ask-a-descoper
c
Hi we are noticing that /refresh is being called continously for some logged in users. would you happen to have any leads as to why that is? we are using the react-sdk and the latest version
s
Make sure the sdk is up to date and clear cache for the users. This should be resolved
c
wdym by this
clear cache for the users
a
@great-diamond-35515 can you please check?
g
hey @colossal-appointment-48082, 1. which react-sdk version are you using? we had an issue related to this 2. can you share a code snippet that reproduce the issue? we had such issue in lower react-sdk version that were fixed in later versions
c
Hey Asaf! so I was using 1.0.8 but recently bumped it to 1.0.9 and yeah so we wrap around your useSession
Copy code
const useDoptSession = () => {
    const session = useSession();

    if (session.isAuthenticated && session.sessionToken !== tokenRef.current) {
      if (!storedRefreshToken()) {
        signInOrUp();
      } else me();
    }
    tokenRef.current = session.sessionToken;
    return session;
  };
then to use it in a guard component
Copy code
export const Guard = ({ children }: PropsWithChildren) => {
  const location = useLocation();
  const { useDoptSession, useUser, validSessionToken } = useAuth();
  const { isSessionLoading, isAuthenticated } = useDoptSession();
...
its worth noting that we don't see this loop for every user. but we do see it consistently for some users, and I haven't been able to reproduce on my machine
I think this is just a use-effect problem on our end
g
cool, let us know if anything pops up!
c
thank you!