Redirected temporarily to login page after refresh

Hello,

I’ve been using The React @auth0/auth0-react package in my app, and everything is working fine. But there is a slight problem that happens when I refresh the page when I’m authenticated.

The browser redirects to the login page for a few seconds, and then back to the original page. I’m using a ProtectedRoute component that uses withAuthenticationRequired. So, how can I remove this seemingly unnecessary redirect?

Thanks

import { withAuthenticationRequired } from "@auth0/auth0-react";
//import useIsDemoAccount from "../../components/shared/hooks/useIsDemoAccount";

export const ProtectedRoute = ({
  component,
  activeDateRange,
  transactionType,
  setSelectedTxType,
}) => {
  const Component = withAuthenticationRequired(component, {
    onRedirecting: () => <div>Loading...</div>,
  });

  return (
    <Component
      activeDateRange={activeDateRange}
      transactionType={transactionType}
      setSelectedTxType={setSelectedTxType}
    />
  );
};

export default ProtectedRoute;