Maciek50322
Maciek50322
SSolidJS
Created by Maciek50322 on 3/28/2025 in #support
Solid router, suspense and navigate
<Router root={<App>{props.children}</App>}>
{routes}
</Router>
<Router root={<App>{props.children}</App>}>
{routes}
</Router>
export default function App(props: { children: JSX.Element }) {
const navigate = useNavigate();
const location = useLocation();
createRenderEffect(() => {
if (location.pathname !== "/login") navigate("/login")
});

return <Suspense>{props.children}</Suspense>
}
export default function App(props: { children: JSX.Element }) {
const navigate = useNavigate();
const location = useLocation();
createRenderEffect(() => {
if (location.pathname !== "/login") navigate("/login")
});

return <Suspense>{props.children}</Suspense>
}
I have 2 routes, let's say /login and /home, the login file is small, loads in 1s, home file is big loads for 10s (because of dependencies). In the case above initially going to /home, it redirects as fast as it can to /login. The /login file is loaded, but suspense still holds until the /home file is loaded, then it shows /login. How can I make it show /login just as soon as it loaded, not waiting for /home ? (not solid start) (Tried it in production build)
20 replies
SSolidJS
Created by Maciek50322 on 3/14/2024 in #support
Need help with running solid-community/solid-primitives
No description
57 replies