AuthContext that uses a getUser server function to retrieve the authenticated user and pass it to the client so it can be used in a useAuth hook. Currently, to protect routes and redirect away if unauthenticated, I request this getUser server function again in the root route to add the user object to the route context, so I can check if it exists in beforeLoad and redirect if it does not. The problem with this setup is that it makes the request to the getUser server function twice in one page load, one to add it to the router context, and another in the AuthContext. I saw that with TanStack Router, one way to get around this would be to use the RouterProvider so I can use the AuthContext in the router context as well, but I see that RouterProvider is not available in TanStack Start. Am I overthinking/overcomplicating things or is there another way to add the user object to the router context without a second request to my server function?https://x.com/powersync_/status/2010721010006552775?s=20
dry-scarlet · 2mo ago
You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 3mo ago
TanStack AI Alpha 2 is here! 🖼️ Image, video, audio, speech, transcription, structured output 📦 Split adapters = smaller bundles, faster dev/contributions, easier 🎄 Fully tree shakable adapters ✨ Cleaner, flattened, fully type-safe APIs https://tanstack.com/blog/tanstack-ai-alpha-2
dry-scarlet · 3mo ago