Open lsthornt opened 4 months ago
From Stackblitz -- System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: @remix-run/dev: * => 2.10.2 @remix-run/node: * => 2.10.2 @remix-run/react: * => 2.10.2 @remix-run/serve: * => 2.10.2 vite: ^5.1.0 => 5.3.3
npm
innerData
useLoaderData
innerContentPromise
InnerComponent
An HMR causes innerComponent to re-render infinitely
innerComponent
Repeatedly running into this, and having to find workarounds.
In digging around, it does feel related to #7809 and #7392 (useMemo not working as expected deferred loader data)
useMemo
Reproduction
System Info
Used Package Manager
npm
Expected Behavior
innerData
promise destructured fromuseLoaderData
is stable, and therefore memoizes correctlyinnerContentPromise
should be calculated once, returning its own stable promiseInnerComponent
should awaitinnerContentPromise
and stop rendering once it has resolvedActual Behavior
An HMR causes
innerComponent
to re-render infinitely