You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a question than an issue: I'm trying to find the optimal way in this template to show different "landing" pages depending on a DB request, I'm searching for a way to do something like this:
The user enters the application
The server receives the initial request, checks in the DB that the user is not onboarded and responds with a flag that indicates that the user should go to the onboarding process
The frontend detects this flag and automatically shows the onboarding process instead of the app's homepage
I could try to make the request to validate if the user is onboarded from the homepage itself while showing a loading icon, but this would hurt the web vitals of the app, that's why I'm searching for a way to detect it in the initial requests of the frontend to the server. Maybe there is an ideal place to put a middleware in this template or something.
Any input is appreciated, thank you.
The text was updated successfully, but these errors were encountered:
Oteiza-a
changed the title
Best way to show different home pages depending on server condition?
Best way to show different initial renders depending on server condition?
Sep 5, 2024
I ended up doing this in the index.jsx file, where i'm running the onboarding validation at the same time as the i18n setup, and pass the onboardingComplete validation to the App via props:
constsetup=Promise.all([// Validate if user is onboarded to switch initial render pageonboardedValidation(),// Ensure that locales are loaded before rendering the appinitI18n(),])setup.then(([onboardingComplete])=>{constroot=createRoot(document.getElementById("app"));root.render(<ApponboardingComplete={onboardingComplete}/>);});
This is more of a question than an issue: I'm trying to find the optimal way in this template to show different "landing" pages depending on a DB request, I'm searching for a way to do something like this:
I could try to make the request to validate if the user is onboarded from the homepage itself while showing a loading icon, but this would hurt the web vitals of the app, that's why I'm searching for a way to detect it in the initial requests of the frontend to the server. Maybe there is an ideal place to put a middleware in this template or something.
Any input is appreciated, thank you.
The text was updated successfully, but these errors were encountered: