Open hsul-git opened 1 year ago
Hi @hsul-git ,
I think i need to see the code inside RouterList in order to understand your problem. Dobyou have a video or a full example i can clone to reproduce it?
Hi @guillaume-chervet ,
Sadly i cant provide the full code. But you should be able to reproduce it with your own project. Just add the OutputAuthState.tsx and inject the components like i did in the Authentication.tsx OidcProvider.
Then try to cause a error in axa-fr so it is forced to render a OidcProvider component which we injected. When you try to use useNavigate() to change the page it wouldnt work anymore, even if the url seems to change. The only fix is to use a link or href to completly revisit the page.
I was not able to test it myself with the standard components by OidcProvider because they have no method to return to the page before.
I will make you a video of the problem. OidcProvider component seems to stay on top and doesnt vanish and blocks the execution of code.
Routes.jsx:
import React from 'react'
import { Route, Routes } from 'react-router-dom'
import Home from './pages/Home'
import InternalArea from './pages/InternalArea'
import Prototypes from './pages/Prototypes'
import ErrorPage from './pages/ErrorPage'
import AuthDisplayPrototype from './pages/AuthDisplayPrototype'
const RouteList = () => {
return (
<div>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/internalarea" element={<InternalArea />} />
<Route path="/prototypes" element={<Prototypes />} />
<Route path="/authprototypes" element={<AuthDisplayPrototype />} />
<Route path="/*" element={<ErrorPage />} />
</Routes>
</div>
)
}
export default RouteList
Hi @hsul-git , sorry for the delay. I will try to test it next tuesday (I couldnt before)
Hi @hsul-git, I cannot reproduce it using the demo.
Are you able to reproduce it using the demo ?
Hi @hsul-git , do you have dynamic component line describe in that issue?
I have two components. One is the AF/R-O config and the other renders components dependend on the state. The Problem is, when a AF/R-O auth state occurs which causes a selfdefined component to display, but the whole page seems to not change anymore. If i click the button to navigate via "takeRedirect" the url changes but the selfdefined component stay instead of rendering the content of the url "/".
Also it seems the code doesnt get executed anymore. On "/" there is a useEffect which directly redirects to a login, which doesnt work then.
The only fix is to close the whole page and revisit. No Error gets provided in this case. Is there a fix or do i inject the components falsely into the OidcProvider?
Is it even possible to redirect when a auth state from AF/R-O is displayed?
Here is my code for further inspection:
Authentication.tsx:
OutputAuthState.tsx:
App.tsx:
Thank you for help.
Edit: I used the mui Link element and that seems to work. That should do the trick so the whole page refreshes. But is there a way to avoid refreshing the whole page?