TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

rival-black
rival-black5/22/2025

Can't access cookie after a location.replace()

An external website makes a redirection to my website. In my loader, I call a serverFn that do a getCookie. The problem is that the external websites seems to execute a location.replace(THE_URL_TO_MY_WEBSITE) and the loader is correctly executed but can't access my website cookie (it returns null). But if I reload my page the loader access correctly the cookie. Any idea?
correct-apricot
correct-apricot5/22/2025

How to use updated client env variable value in production app?

I'm using t3 env + trpc for current tanstack app. After build the image for the bun preset. when i run the app in production i'm getting env variable error as shown in images. I'm running app using bun run .output/server/index.mjs in production. How can i pass env variable when i run the bun run .output/server/index.mjs command and how to actually parse it in trpc routes. Since it server using import.meta.env.VITE_API_URL it not a best option right!!!...
No description
notable-maroon
notable-maroon5/22/2025

Are server function URLs exposed publically?

I conduct auth checks in my beforeLoad route function and I have a serverFn named getData that I only ever call in the loader function. Do I need to check user auth in the getData function as well? I.e. is it possible for an attacker to find and use the server function endpoint without the route context?...
ambitious-aqua
ambitious-aqua5/21/2025

Root route loader being called multiple times

I am trying to call a function once on route load but it is being called multiple times. I tried both beforeLoad and loader but both have the same results. I do have two pathless layouts under the root route, which is why I think the loader is being called three times, but I am not sure. Any help would be appreciated.
correct-apricot
correct-apricot5/21/2025

How to add reverse proxy for production?

I'm currently using Tanstack start with tanstack query to fetch data from external api using axios.get("/api/images") which is running on localhost:9999. Now in app.config.ts there is only option for devProxy /api -> localhost:9999 which is working fine in devlopment. When i switch production build and run that the proxy doen't seems to be working even if i set the reverse proxy in caddy.
Throw an error: ERR_INVALID_URL ...
grumpy-cyan
grumpy-cyan5/20/2025

Adding request headers when calling useServerFn for CSRF implementation

I am trying to implement CSRF wherein i need to pass request header which will be my csrf token received during login request, can someone direct on how to achieve this functionality. I am using useServerFn to make requests wherein this would be implemented
metropolitan-bronze
metropolitan-bronze5/20/2025

Server Assets

Hi Is there a way to include assets that are used only in server functions into the final build? For example say I have a file that is read and used in the server function and I want this bundled, what is the best way to achieve this?...
robust-apricot
robust-apricot5/19/2025

QueryClient cache getting invalidated between navigation?

hello! running into a weird bug with my app. my currentUser state is managed in an isomorphic QueryClient, but it seems to return inconsistent behavior throughout the app. when i am logged in: * visiting /chat correctly loads the active user from state * visiting /chat, then visiting /, then reloading, then visiting /chat shows i am logged out! a simple refresh corrects the state. ...
extended-salmon
extended-salmon5/19/2025

Entra SSO auth

Hey all - does anyone have any advice or examples on how to approach adding auth with Microsoft Entra to my start app? I have achieved it fine for my client-side, using msal-browser and msal-react, but I have no idea how to keep a session in my server-side code. Ideal outcome is being able to lock down all my routes (pages and APIs), and pass on the access token to my backend APIs in the auth header, which could be called from either client or server side. Thanks!
like-gold
like-gold5/19/2025

any good examples of cookie based authentication with tanstack start + tRPC?

It seems like all the examples I'm finding use a third party auth provider, and I'd love a solid example of using a more complex tRPC implementation other than just a few public procedures. The part I'm having the most difficulty with is the authentication process and maintaining the proper auth state between the server and the client. Would love some examples to help me pinpoint what I might be doing wrong!
extended-yellow
extended-yellow5/19/2025

typesafe search param in API route

I am new to TanStack Start. Wondering if I can get typesafe search params from an API route with or without validations? Thanks in advance....
extended-yellow
extended-yellow5/19/2025

Get API URL(link) from server function & API route

Hi team thanks for the awesome stack. I wonder if there is a typesafe way to get the URL of an api route, e.g. https://mydomain.com/api/thatCallback, from within a server function or API route? If not, just getting a relative path is also good....
optimistic-gold
optimistic-gold5/19/2025

CLI?

May I ask when we will be able to start a new project using the CLI and completely move away from Vinxi? I’ve found that Vinxi doesn’t support Vite’s environment variables, which is making the code quite messy.
fair-rose
fair-rose5/19/2025

Custom server entry

Is there a way to modify server.tsx in a way that Kent does here for Remix? https://github.com/kentcdodds/kentcdodds.com/commit/54d11cefd15ece5a3ff0f1ab7233dfe2422fead8 Really, I'm just interested in trying to get his BlurImage component to work in Start...
deep-jade
deep-jade5/18/2025

Excluding packages from bundle

I'm getting these errors: ``` X [ERROR] Could not resolve "term.js" node_modules/.pnpm/blessed@0.1.81/node_modules/blessed/lib/widgets/terminal.js:93:22:...
ratty-blush
ratty-blush5/18/2025

ParentRoute data sharing not working on Alpha

Trying to do the following ``` // routes/folder/index.tsx export const Route = createFileRoute({...
conscious-sapphire
conscious-sapphire5/17/2025

Tanstack alpha issues: ERROR: Could not resolve "tanstack:start-manifest"

Im trying to setup lingui on tanstack alpha, however I am running into the above error when trying to run dev mode. Heres the stack blitz: https://stackblitz.com/~/github.com/UngusCode/tanstack-lingui Would appreciate any help, thanks....
like-gold
like-gold5/17/2025

Prevent default values from updating when value changes

Issue: I need help implementing a form field that: Initializes with real-time data (unitPrice from Firebase) doesn't update when the value is changed from firebase, but updates when other value only got changed (basicly user can choose between assets and choosing between asssets (that already have cached data from RQ) will not trigger loading so it will not reset) ...
like-gold
like-gold5/16/2025

Cannot set headers after they are sent to the client

Sometime got this error when call getSession ( server function ) with tanstack Start Looks like same as. => https://github.com/TanStack/router/issues/2837...
afraid-scarlet
afraid-scarlet5/16/2025

API route error handling

What is the expected behaviour returning rejected promises in an API route? I do not see any errors in the logs, and the API returns a 503 status code. I was expecting an error message and a 500 status code....