-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Exporting a loader with a name results in full document reloads on use in fetcher #7957
Comments
Thanks for the reproduction. When I look at the network devtool, I see
The 2nd one is to load client route module, but its content looks like below.
I cannot think of a general solution, but at least for this specific reproduction, one workaround could be to wrap export const namedLoader = (args) => loader(args); (EDIT: Another "fix" would be to move out exports/imports between route files into non-route utility file, which is also currently required for HMR to work as well https://remix.run/docs/en/main/discussion/hot-module-replacement#supported-exports) The full reload mechanism is coming from here: remix/packages/remix-react/routeModules.ts Lines 134 to 143 in d437e79
Currently there's no logging and it's quite puzzling at first. So, maybe it might make sense to add
|
With Vite, Remix is forced to become stricter about allowed route exports. Exporting user-defined names like For rationale see #8171 and https://remix.run/docs/en/dev/future/vite#strict-route-exports |
I have some loaders that I will also export a named version of them for use in other loaders. I have noticed that I have peculiar results with a vite build as of 2.2.0.
What version of Remix are you using?
0.0.0-nightly-8543efe-20231108
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
https://github.com/ZipBrandon/remix-export-loader-fullreload
and start repofetch from api.helloWorld
and it behaves as expectedfetch from api.helloWorldNamed
and it causes full reloadExpected Behavior
Fetch and return data asynchronously
Actual Behavior
Causing a full reload.
The text was updated successfully, but these errors were encountered: