Getting User Info from route page
I might be fundamentally misunderstanding how this is supposed to work, so if that is the case please let me know.
I'm authenticating with Supabase via the /signin route, which stores the jwt in a cookie.
Now, when I load up index.tsx I'm hoping to get the User data to render on the page. Something simple like a "Hello {Username}".
Here is what my index.tsx looks like:
getUser()
works as expected and retrieves the user's information. The console.log in routeData() displays user data. Hooray.
How do I get that same data into the component? useRouteData
doesn't seem to have it, and the console.log("Render:"...
seems to be happening well before the routeData()
function has finished.
This is where I think there's a gap in my understanding of how this works. So any insight would be incredible.
Thank you all,19 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
How did you do that?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Any example helps me learn. Thank you very much!
So this is working great, I'm getting user info now:
But the button isn't firing when I click it.
Is there something I need to do to get buttons working on a page?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
console.log doesn't show in browser or in console, and none of the logs show up during the signout function, so fairly certain it's never getting there.
Basically nothing happens
If I extract the
<Form>
component from createServerData$
, and wrap my button in that, it works. Just feels like a pattern I'm not used to yet, I guess.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yeah that's where I'm at. Was just wondering if I was missing something silly like button onclick's don't work on SSR pages or something
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I'd probably see that in logs somewhere, right?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Can I see it please?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Weird, I'll keep looking into what's weird about my instance.
Thank you for this
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Nope
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View