Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientLoader behaviour change since v2.12.0 #10135

Open
wong2 opened this issue Oct 18, 2024 · 4 comments
Open

clientLoader behaviour change since v2.12.0 #10135

wong2 opened this issue Oct 18, 2024 · 4 comments

Comments

@wong2
Copy link

wong2 commented Oct 18, 2024

Reproduction

I have a route using client loader like this:

export const loader = async ({ params }: LoaderFunctionArgs) => {
  const botInfo = BUILTIN_CHATBOTS[params.botId]
  return {
    title: botInfo.name,
  }
}

export const clientLoader = ({ params }: ClientLoaderFunctionArgs) => {
  const botInfo = BUILTIN_CHATBOTS[params.botId]
  return {
    title: botInfo.name,
  }
}

In v2.11.2 everything works as expected, when user navigate on the client, the page renders instantly using data from clientLoader without any HTTP request or delay.

But since updating Remix to v2.12.0, navigating on the client lags due to waiting for an HTTP request to the remote loader.

System Info

Vite: v5.4.9
Remix packages: v2.13.1

Used Package Manager

pnpm

Expected Behavior

Instant client side navigation without HTTP request.

Actual Behavior

Navigating on the client lags due to waiting for an HTTP request to the remote loader.

@brophdawg11
Copy link
Contributor

Could you provide a reproduction? This works as expected for me in https://stackblitz.com/edit/remix-run-remix-wh2dyw?file=app%2Froutes%2Fpage.tsx

@wong2
Copy link
Author

wong2 commented Oct 19, 2024

@brophdawg11 You can experience it at https://app.chathub.gg by clicking items on the sidebar.

@wong2
Copy link
Author

wong2 commented Oct 21, 2024

More information:

The route hierarchy looks like this:
root -> _chat -> _chat.chat.$botId each route has its own loader definition, and only _chat.chat.$botId has clientLoader definition.

I think it could be related with https://remix.run/docs/en/main/guides/single-fetch#normal-navigation-behavior

@brophdawg11
Copy link
Contributor

Could you please boil the issue down to a minimal reproduction via https://remix.new?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants