remix-run / remix

Build Better Websites. Create modern, resilient user experiences with web fundamentals.
https://remix.run
MIT License
29.72k stars 2.5k forks source link

`clientLoader` behaviour change since v2.12.0 #10135

Open wong2 opened 1 day ago

wong2 commented 1 day ago

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 commented 1 day ago

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 commented 11 hours ago

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