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 hydration message shows in SPA that doesn't use clientLoader #9897

Closed
joryphillips opened this issue Aug 21, 2024 · 2 comments · Fixed by #9899
Closed

clientLoader hydration message shows in SPA that doesn't use clientLoader #9897

joryphillips opened this issue Aug 21, 2024 · 2 comments · Fixed by #9899

Comments

@joryphillips
Copy link

Reproduction

  1. Fork https://github.com/joryphillips/macarons, a Remix SPA project using React 19.0.0-rc-a960b92c-20240819 so that HMR works, that does not include any clientLoader functions
  2. Use npm run dev to see console message mentioned below
  3. Use npm run build and then serve it to also see console message in hosted build

The message is

💿 Hey developer 👋. You can provide a way better UX than this when your app is running `clientLoader` functions on hydration. Check out https://remix.run/route/hydrate-fallback for more information.

System Info

System:
    OS: macOS 14.6.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 1.24 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.11.1/bin/npm
  Browsers:
    Safari: 17.6
  npmPackages:
    @remix-run/css-bundle: 2.11.2 => 2.11.2 
    @remix-run/dev: 2.11.2 => 2.11.2 
    @remix-run/eslint-config: 2.11.2 => 2.11.2 
    @remix-run/node: 2.11.2 => 2.11.2 
    @remix-run/react: 2.11.2 => 2.11.2 
    @remix-run/serve: 2.11.2 => 2.11.2 
    vite: ^5.4.1 => 5.4.1

Used Package Manager

npm

Expected Behavior

SPA project with no clientLoader functions should not have console message about clientLoaders, especially in the final build

Actual Behavior

SPA project with no clientLoader functions is showing console message about clientLoaders in both dev and build

@brophdawg11
Copy link
Contributor

This message should probably be tweaked so it's not specific to clientLoader but the message is accurate. In SPA mode even without client loaders - your application has to load all of the JS bundles before it can render anything to the user. Without a HydrateFallback you just show the user a completely blank white screen while all of that is loading. Remix encourages you to add a root HydrateFallback to show them some sort of loading message or spinner or something. That HydrateFallback ends up in the initial index.html document so it shows to the user immediately.

@joryphillips
Copy link
Author

I was wondering if that might be the case.

I did try adding a HydrateFallback but for some reason my app got stuck on that and never hydrated. I'll take another look at that.

@brophdawg11 brophdawg11 linked a pull request Aug 21, 2024 that will close this issue
@brophdawg11 brophdawg11 added the awaiting release This issue has been fixed and will be released soon label Aug 22, 2024
@brophdawg11 brophdawg11 removed the awaiting release This issue has been fixed and will be released soon label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants