TanStackT
TanStack9mo ago
6 replies
full-green

Loader context missing in production

Hey everyone! I usually don’t reach out for support unless I’ve been running in circles, and at this point, I’ve exhausted my options.

I’m running into an issue where some loader data isn’t available in production builds, even though everything works perfectly in development.

I’m using the latest version of Start along with BetterAuth for authentication.

Here’s the loader used across all relevant pages:
loader: async ({ context }) => {
    return {
        user: context.user,
    };
},


The problem is that on my index route (
/
), the
user
isn’t passed through in production, but it is in development. Other routes like /account use the exact same loader setup, and they work fine in both environments.

I’m accessing the data like this:
const { user } = Route.useLoaderData();


Has anyone run into something similar or have any insights on what might be going wrong?

Appreciate any help!
Was this page helpful?