Redirect back from idp with state params doesnt work well with BrowserRouter

I am using the auth0 library and when a user hits a protected page but is not authenticated they are redirected to the idp using this library

export default withAuthenticationRequired(ProtectedPage , {
  // Show a message while the user waits to be redirected to the login page.
  onRedirecting: () => (<div>Redirecting you to the login page...</div>),
});

After the user logs in they are redirected back to the authenticated redirect page

The library then reloads the initial page from the state passed to the idp (and back)

The issue is

I have a BrowserRouter and the BrowserRouter only renders from the initial page redirected from the idp

myapp?code=asdaddadasd

When the state changes the url of the page the browser router is not rerendered and i am stuck on the home page

I can get the behaviour to work using my own custom code but wwould prefer to use the code you provide

Any help would be great