You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While exploring the React Router example from https://github.com/remix-run/react-router/tree/main/examples/ssr-data-router, I encountered an unexpected behavior: the loader function is executing on the client side instead of the anticipated server side. This behavior is not ideal and may lead to security concerns.
add the line console.log("Home Loader") into homeLoader function
Build and run:
$ npm run build
$ npm run start
After clicking the Home link, "Home Loader" is logged in the browser console. This indicates that the loader function is executing on the client side, which is unexpected and should be avoided. Ideally, the loader function and action function should be excluded from the client bundle.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
While exploring the React Router example from https://github.com/remix-run/react-router/tree/main/examples/ssr-data-router, I encountered an unexpected behavior: the loader function is executing on the client side instead of the anticipated server side. This behavior is not ideal and may lead to security concerns.
Reproduce:
and do some modification:
"type": "module"
to package.jsonimport
instead ofrequire
in server.jsconsole.log("Home Loader")
into homeLoader functionAfter clicking the Home link, "Home Loader" is logged in the browser console. This indicates that the loader function is executing on the client side, which is unexpected and should be avoided. Ideally, the loader function and action function should be excluded from the client bundle.
The guide said:
So it seems the loader function was not tree shaken off in this example.
How can I fix this?
Beta Was this translation helpful? Give feedback.
All reactions