-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Labels
Description
I'm using React Router as a...
framework
Reproduction
I have a route where I forgot to return in a loader function. This wasn't a problem unless I upgraded from 7.4.1 to 7.5.3
After the upgrade there is an error in the browser:
TypeError: Cannot use 'in' operator to search for 'error' in undefined
at unwrapSingleFetchResult (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:7742:15)
at http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:7559:20
at async dataRoute.loader (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:8059:24)
at async http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:7557:24
at async http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:5135:19
at async callLoaderOrAction (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:5187:16)
at async Promise.all (index 1)
at async singleFetchLoaderNavigationStrategy (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:7581:3)
at async callRouteMiddleware (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:4901:37)
at async runMiddlewarePipeline (http://localhost:3000/node_modules/.vite/deps/chunk-X5OJKGOA.js?v=706cb39c:4867:18)
When I add a return null in the loader the error is gone. The loader is only used for authentication, that's why I don't return data.
System Info
System:
OS: Linux 6.11 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (16) x64 AMD Ryzen 9 PRO 7940HS w/ Radeon 780M Graphics
Memory: 12.41 GB / 29.99 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 22.13.0 - /run/user/1000/fnm_multishells/6679_1745822615001/bin/node
npm: 10.9.2 - /run/user/1000/fnm_multishells/6679_1745822615001/bin/npm
pnpm: 9.11.0 - ~/.local/share/pnpm/pnpm
Browsers:
Chrome: 134.0.6998.165
npmPackages:
@react-router/dev: ^7.5.3 => 7.5.3
@react-router/express: ^7.5.3 => 7.5.3
@react-router/node: ^7.5.3 => 7.5.3
react-router: ^7.5.3 => 7.5.3
vite: ^6.2.2 => 6.3.1Used Package Manager
npm
Expected Behavior
Either not returning is allowed or error with a meaningful message is thrown.
Actual Behavior
An error occurs in the browser when trying to unwrap the loader data: TypeError: Cannot use 'in' operator to search for 'error' in undefined