I'm using convex + convex auth.
I'm using convex + convex auth.
This is the layout of protected routes:
One of the struggles I have is that during submission when logging in, we navigate a bit too fast, causing the protected layout route to run, which in turn redirects us to the register route.
10 Replies
Giving more info in this thread.
this is the submit function in login
i see that result gives me signing in
so maybe i shouldn't be the one causing the navigation to happen
but rather let it happen as a result
so guest route would navigate
still annoying i can't trigger a toast message here when done š¤
----------------------
i think we're having this issue because im navigating before signing in has successfully happened
yes
that does the job
@Michal Srb @Wayne
this should be better documented
shouldn't be an issue at all
like running into this issue
yeah
nothing in here about redirecting https://labs.convex.dev/auth/config/passwords
Passwords - Convex Auth
Authentication library for your Convex backend
@MapleLeaf š have you encountered a similar issue with aspects vtt?
although you were using discord oauth were u can pass the redirectTo as argument
yeah definitely wouldn't redirect during render like this
I handle protected routes by rendering either the content or the login/signup form depending on the auth state
alternatively, you could redirect away from register/login if they're logged in
could risk some UI state flicker, but I tend to do that generally
yeah what im doing now is relying on the guest + protected layouts
in remix that'd be _protected or _guest.tsx
when doing flat routes
workes nicely
i dont need toast messages for the mvp, all good
@MapleLeaf š
now im running into this issue when logging in strangely with the approach mentioned "Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."
cc @Michal Srb @Wayne
Cannot update a component (RouterProvider
) while rendering a different component (Guest
). To locate the bad setState() call insideGuest
, follow the stack trace as described in https://react.dev/link/setstate-in-render
GitHub
Bug: too hard to fix "Cannot update a component from inside the fun...
Note: React 16.13.1 fixed some cases where this was overfiring. If upgrading React and ReactDOM to 16.13.1 doesn't fix the warning, read this: #18178 (comment) React version: 16.13.0 Steps To R...
ok seems like i need the use effect after all š
oh yeah lol bare navigate call in render will do that
@Tiger š
have you resolved all your issues?
yes
all resolved so far
building it productively
exciting stuff ahead
š
love me da mutations
its going well
imma share it in #show-and-tell
yall better support when the time comes :3
hahahaha
much love
:BunnyLove: