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

Fix:- Improve HOC support and state preservation in React Refresh #30660

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Biki-das
Copy link
Contributor

@Biki-das Biki-das commented Aug 12, 2024

Summary

This fixes #30659 , the issue was how the state was preserved and needed special cases for the forward and memo, have also added tests related to the same.

How did you test this change?

yarn test packages/react-refresh/src/__tests__/ReactFresh-test.js

Screenshot 2024-08-12 at 4 27 39 PM

Copy link

vercel bot commented Aug 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 0:43am

@react-sizebot
Copy link

react-sizebot commented Aug 12, 2024

Comparing: e5a2062...bfc9467

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 514.24 kB 513.96 kB +0.05% 91.73 kB 91.78 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 557.28 kB 550.36 kB = 98.97 kB 97.97 kB
facebook-www/ReactDOM-prod.classic.js = 595.79 kB 595.79 kB = 104.85 kB 104.85 kB
facebook-www/ReactDOM-prod.modern.js = 586.21 kB 586.21 kB = 103.30 kB 103.31 kB
oss-experimental/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
oss-stable-semver/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
oss-stable/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
facebook-www/ReactFreshRuntime-dev.classic.js +11.68% 12.37 kB 13.82 kB +6.68% 2.99 kB 3.19 kB
facebook-www/ReactFreshRuntime-dev.modern.js +11.68% 12.37 kB 13.82 kB +6.68% 2.99 kB 3.19 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js = 410.35 kB 400.88 kB = 71.26 kB 69.87 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js = 409.57 kB 400.10 kB = 71.11 kB 69.70 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js = 405.52 kB 396.05 kB = 70.55 kB 69.16 kB
facebook-react-native/react-dom/cjs/ReactDOM-dev.js = 17.57 kB 17.15 kB = 3.89 kB 3.78 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js = 343.60 kB 335.42 kB = 65.21 kB 63.86 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js = 384.72 kB 375.46 kB = 68.24 kB 66.87 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js = 384.72 kB 375.46 kB = 68.24 kB 66.87 kB
oss-experimental/react-markup/cjs/react-markup.react-server.production.js = 314.98 kB 307.39 kB = 58.89 kB 57.74 kB
oss-experimental/react-markup/cjs/react-markup.development.js = 356.28 kB 347.62 kB = 63.97 kB 62.80 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js = 371.54 kB 362.30 kB = 67.05 kB 65.70 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js = 371.46 kB 362.23 kB = 66.99 kB 65.64 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js = 370.77 kB 361.53 kB = 66.88 kB 65.54 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js = 370.69 kB 361.46 kB = 66.83 kB 65.49 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js = 367.31 kB 358.08 kB = 66.24 kB 64.88 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js = 367.24 kB 358.00 kB = 66.19 kB 64.83 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js = 316.60 kB 308.43 kB = 61.63 kB 60.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js = 316.53 kB 308.35 kB = 61.61 kB 60.26 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js = 355.28 kB 346.08 kB = 64.68 kB 63.32 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js = 355.27 kB 346.08 kB = 64.68 kB 63.32 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js = 355.25 kB 346.06 kB = 64.66 kB 63.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js = 355.25 kB 346.05 kB = 64.66 kB 63.29 kB
facebook-www/ReactDOMServer-dev.classic.js = 378.66 kB 368.81 kB = 67.95 kB 66.49 kB
facebook-www/ReactDOMServer-dev.modern.js = 371.83 kB 361.94 kB = 66.94 kB 65.53 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js = 363.39 kB 353.68 kB = 65.68 kB 64.23 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.js = 260.04 kB 251.81 kB = 46.03 kB 44.80 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.js = 254.27 kB 246.18 kB = 43.96 kB 42.76 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.js = 256.09 kB 247.87 kB = 45.11 kB 43.88 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js = 233.38 kB 225.53 kB = 42.89 kB 41.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js = 233.30 kB 225.45 kB = 42.86 kB 41.65 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js = 228.17 kB 220.46 kB = 40.92 kB 39.73 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js = 228.10 kB 220.38 kB = 40.90 kB 39.70 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js = 229.92 kB 222.07 kB = 41.91 kB 40.70 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js = 229.85 kB 221.99 kB = 41.89 kB 40.67 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.js = 232.87 kB 224.85 kB = 41.86 kB 40.64 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.js = 232.05 kB 223.89 kB = 42.40 kB 41.17 kB
oss-experimental/react-markup/cjs/react-markup.production.js = 215.24 kB 207.66 kB = 39.74 kB 38.64 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.js = 226.97 kB 218.95 kB = 40.49 kB 39.32 kB
facebook-www/ReactDOMServer-prod.classic.js = 219.75 kB 211.83 kB = 39.63 kB 38.49 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js = 221.38 kB 213.32 kB = 40.93 kB 39.64 kB
facebook-www/ReactDOMServer-prod.modern.js = 217.07 kB 209.11 kB = 39.30 kB 38.13 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.js = 213.79 kB 205.93 kB = 39.48 kB 38.26 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.js = 213.71 kB 205.85 kB = 39.45 kB 38.24 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.js = 213.95 kB 206.01 kB = 40.03 kB 38.82 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.js = 213.93 kB 205.99 kB = 40.00 kB 38.79 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.js = 209.44 kB 201.64 kB = 38.26 kB 37.08 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.js = 209.41 kB 201.61 kB = 38.23 kB 37.05 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 84.44 kB 80.38 kB = 14.95 kB 14.63 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 82.49 kB 78.52 kB = 14.67 kB 14.37 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 82.49 kB 78.52 kB = 14.67 kB 14.37 kB
facebook-www/ReactCacheOld-dev.classic.js = 7.35 kB 7.00 kB = 2.12 kB 2.02 kB
facebook-www/ReactCacheOld-dev.modern.js = 7.35 kB 7.00 kB = 2.12 kB 2.02 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 92.36 kB 87.86 kB = 15.05 kB 14.73 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 92.36 kB 87.86 kB = 15.05 kB 14.73 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 94.56 kB 89.94 kB = 15.31 kB 14.97 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
facebook-www/ReactReconcilerConstants-dev.classic.js = 0.63 kB 0.60 kB = 0.35 kB 0.34 kB
facebook-www/ReactReconcilerConstants-dev.modern.js = 0.63 kB 0.60 kB = 0.35 kB 0.34 kB
oss-experimental/react-server/cjs/react-server.development.js = 187.30 kB 177.55 kB = 32.71 kB 31.27 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-experimental/react-server/cjs/react-server.production.js = 129.09 kB 122.29 kB = 22.45 kB 21.47 kB
oss-stable-semver/react-server/cjs/react-server.production.js = 115.33 kB 108.53 kB = 20.62 kB 19.61 kB
oss-stable/react-server/cjs/react-server.production.js = 115.33 kB 108.53 kB = 20.62 kB 19.61 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 166.34 kB 156.48 kB = 29.97 kB 28.46 kB
oss-stable/react-server/cjs/react-server.development.js = 166.34 kB 156.48 kB = 29.97 kB 28.46 kB
facebook-react-native/react-dom/cjs/ReactDOMTestUtils-dev.js = 1.80 kB 1.39 kB = 0.84 kB 0.71 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
oss-stable-semver/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
oss-stable/react-refresh/cjs/react-refresh-runtime.development.js +11.69% 12.36 kB 13.80 kB +6.77% 2.98 kB 3.18 kB
facebook-www/ReactFreshRuntime-dev.classic.js +11.68% 12.37 kB 13.82 kB +6.68% 2.99 kB 3.19 kB
facebook-www/ReactFreshRuntime-dev.modern.js +11.68% 12.37 kB 13.82 kB +6.68% 2.99 kB 3.19 kB
oss-experimental/react-art/cjs/react-art.development.js = 614.74 kB 610.99 kB = 97.88 kB 97.22 kB
facebook-www/React-dev.classic.js = 70.99 kB 70.47 kB = 15.49 kB 15.38 kB
facebook-www/React-dev.modern.js = 70.99 kB 70.47 kB = 15.49 kB 15.38 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js = 1,045.14 kB 1,037.41 kB = 175.83 kB 174.78 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js = 1,044.62 kB 1,036.87 kB = 174.92 kB 173.91 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js = 1,028.23 kB 1,020.47 kB = 172.09 kB 171.08 kB
facebook-react-native/react/cjs/React-dev.js = 66.68 kB 66.12 kB = 14.68 kB 14.54 kB
oss-experimental/react/cjs/react.development.js = 46.15 kB 45.75 kB = 10.53 kB 10.44 kB
oss-experimental/react-art/cjs/react-art.production.js = 322.55 kB 319.35 kB = 54.86 kB 54.26 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js = 715.50 kB 707.89 kB = 112.85 kB 111.64 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js = 613.51 kB 606.60 kB = 107.73 kB 106.65 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js = 572.01 kB 565.09 kB = 102.57 kB 101.59 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 557.28 kB 550.36 kB = 98.97 kB 97.97 kB
facebook-www/JSXDEVRuntime-dev.classic.js = 28.44 kB 28.08 kB = 6.68 kB 6.60 kB
facebook-www/JSXDEVRuntime-dev.modern.js = 28.44 kB 28.08 kB = 6.68 kB 6.60 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js = 26.77 kB 26.39 kB = 6.31 kB 6.22 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js = 26.51 kB 26.13 kB = 6.29 kB 6.20 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js = 480.90 kB 473.91 kB = 76.64 kB 75.66 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.js = 427.88 kB 420.89 kB = 68.85 kB 67.84 kB
oss-experimental/react/cjs/react.production.js = 18.42 kB 18.11 kB = 4.77 kB 4.70 kB
oss-experimental/react-markup/cjs/react-markup.react-server.development.js = 529.48 kB 520.55 kB = 94.93 kB 93.72 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js = 410.35 kB 400.88 kB = 71.26 kB 69.87 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js = 409.57 kB 400.10 kB = 71.11 kB 69.70 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js = 405.52 kB 396.05 kB = 70.55 kB 69.16 kB
facebook-react-native/react-dom/cjs/ReactDOM-dev.js = 17.57 kB 17.15 kB = 3.89 kB 3.78 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js = 343.60 kB 335.42 kB = 65.21 kB 63.86 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js = 384.72 kB 375.46 kB = 68.24 kB 66.87 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js = 384.72 kB 375.46 kB = 68.24 kB 66.87 kB
oss-experimental/react-markup/cjs/react-markup.react-server.production.js = 314.98 kB 307.39 kB = 58.89 kB 57.74 kB
oss-experimental/react-markup/cjs/react-markup.development.js = 356.28 kB 347.62 kB = 63.97 kB 62.80 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js = 371.54 kB 362.30 kB = 67.05 kB 65.70 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js = 371.46 kB 362.23 kB = 66.99 kB 65.64 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js = 370.77 kB 361.53 kB = 66.88 kB 65.54 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js = 370.69 kB 361.46 kB = 66.83 kB 65.49 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js = 367.31 kB 358.08 kB = 66.24 kB 64.88 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js = 367.24 kB 358.00 kB = 66.19 kB 64.83 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js = 316.60 kB 308.43 kB = 61.63 kB 60.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js = 316.53 kB 308.35 kB = 61.61 kB 60.26 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js = 355.28 kB 346.08 kB = 64.68 kB 63.32 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js = 355.27 kB 346.08 kB = 64.68 kB 63.32 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js = 355.25 kB 346.06 kB = 64.66 kB 63.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js = 355.25 kB 346.05 kB = 64.66 kB 63.29 kB
facebook-www/ReactDOMServer-dev.classic.js = 378.66 kB 368.81 kB = 67.95 kB 66.49 kB
facebook-www/ReactDOMServer-dev.modern.js = 371.83 kB 361.94 kB = 66.94 kB 65.53 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js = 363.39 kB 353.68 kB = 65.68 kB 64.23 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.js = 260.04 kB 251.81 kB = 46.03 kB 44.80 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.js = 254.27 kB 246.18 kB = 43.96 kB 42.76 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.js = 256.09 kB 247.87 kB = 45.11 kB 43.88 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 27.79 kB = 5.64 kB 5.54 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.18 kB = 5.77 kB 5.67 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js = 233.38 kB 225.53 kB = 42.89 kB 41.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js = 233.30 kB 225.45 kB = 42.86 kB 41.65 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js = 228.17 kB 220.46 kB = 40.92 kB 39.73 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js = 228.10 kB 220.38 kB = 40.90 kB 39.70 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js = 229.92 kB 222.07 kB = 41.91 kB 40.70 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js = 229.85 kB 221.99 kB = 41.89 kB 40.67 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.js = 232.87 kB 224.85 kB = 41.86 kB 40.64 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.js = 232.05 kB 223.89 kB = 42.40 kB 41.17 kB
oss-experimental/react-markup/cjs/react-markup.production.js = 215.24 kB 207.66 kB = 39.74 kB 38.64 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.js = 226.97 kB 218.95 kB = 40.49 kB 39.32 kB
facebook-www/ReactDOMServer-prod.classic.js = 219.75 kB 211.83 kB = 39.63 kB 38.49 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js = 221.38 kB 213.32 kB = 40.93 kB 39.64 kB
facebook-www/ReactDOMServer-prod.modern.js = 217.07 kB 209.11 kB = 39.30 kB 38.13 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.js = 213.79 kB 205.93 kB = 39.48 kB 38.26 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.js = 213.71 kB 205.85 kB = 39.45 kB 38.24 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.js = 213.95 kB 206.01 kB = 40.03 kB 38.82 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.js = 213.93 kB 205.99 kB = 40.00 kB 38.79 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.js = 209.44 kB 201.64 kB = 38.26 kB 37.08 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.js = 209.41 kB 201.61 kB = 38.23 kB 37.05 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 84.44 kB 80.38 kB = 14.95 kB 14.63 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 82.49 kB 78.52 kB = 14.67 kB 14.37 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 82.49 kB 78.52 kB = 14.67 kB 14.37 kB
facebook-www/ReactCacheOld-dev.classic.js = 7.35 kB 7.00 kB = 2.12 kB 2.02 kB
facebook-www/ReactCacheOld-dev.modern.js = 7.35 kB 7.00 kB = 2.12 kB 2.02 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 92.36 kB 87.86 kB = 15.05 kB 14.73 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 92.36 kB 87.86 kB = 15.05 kB 14.73 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 94.56 kB 89.94 kB = 15.31 kB 14.97 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.production.js = 6.05 kB 5.75 kB = 1.52 kB 1.47 kB
facebook-www/ReactReconcilerConstants-dev.classic.js = 0.63 kB 0.60 kB = 0.35 kB 0.34 kB
facebook-www/ReactReconcilerConstants-dev.modern.js = 0.63 kB 0.60 kB = 0.35 kB 0.34 kB
oss-experimental/react-server/cjs/react-server.development.js = 187.30 kB 177.55 kB = 32.71 kB 31.27 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.development.js = 7.31 kB 6.92 kB = 1.59 kB 1.54 kB
oss-experimental/react-server/cjs/react-server.production.js = 129.09 kB 122.29 kB = 22.45 kB 21.47 kB
oss-stable-semver/react-server/cjs/react-server.production.js = 115.33 kB 108.53 kB = 20.62 kB 19.61 kB
oss-stable/react-server/cjs/react-server.production.js = 115.33 kB 108.53 kB = 20.62 kB 19.61 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 166.34 kB 156.48 kB = 29.97 kB 28.46 kB
oss-stable/react-server/cjs/react-server.development.js = 166.34 kB 156.48 kB = 29.97 kB 28.46 kB
facebook-react-native/react-dom/cjs/ReactDOMTestUtils-dev.js = 1.80 kB 1.39 kB = 0.84 kB 0.71 kB

Generated by 🚫 dangerJS against 8acf0a8

@Biki-das
Copy link
Contributor Author

@gaearon did you encounter this error? if yes could you help me out if this fix looks right.

@Biki-das
Copy link
Contributor Author

Biki-das commented Oct 3, 2024

cc @josephsavona
Might be something to fix. would love to know your thoughts

@hoxyq
Copy link
Contributor

hoxyq commented Oct 16, 2024

Hey @Biki-das, apologies for a long wait. I think we should find an owner for react-refresh, I am not sure when was the last time react-refresh was actually updated.

@Biki-das
Copy link
Contributor Author

hi @hoxyq 😅 no worries, i understand the team have other priorities and i guess dan was requested for review while ago, but since he is no more actively a part of the react team, so might not be something that gets attention, yeah the last change was long back, but this seems to be an important bug that shall be fixed as this occurs in Nextjs as well.
yeah we should find someone who knows about the react refresh code.

@Biki-das
Copy link
Contributor Author

@hoxyq any update on this,
may be @poteto

@hoxyq
Copy link
Contributor

hoxyq commented Nov 18, 2024

@hoxyq any update on this,

may be @poteto

Hey, @Biki-das, no updates from me, I am currently on leave and will be back in December.

@Biki-das
Copy link
Contributor Author

Biki-das commented Jan 1, 2025

@hoxyq whenever you return and if you are a bit less busy, could you forward this further to someone who might have idea about react refresh, feel like this fix could be important.

@Biki-das
Copy link
Contributor Author

@eps1lon any thoughts on who can review this, i see react refresh has not been touched for a long time? could we get someone to review this if you know someone.

Copy link
Contributor

@hoxyq hoxyq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, and changes make sense, few points:

  • Could you please retitle this PR to something that describes what's being added to Fresh?
  • Could you please add tests that will check that state is not preserved when switching between different wrappers?

@Biki-das
Copy link
Contributor Author

@hoxyq thanks for the feedback sure i will try to add the required tests and change the PR title as well.

@Biki-das
Copy link
Contributor Author

@hoxyq let me know if the new tests added are what you expected, and the reset test is running fine, we have a playwright test fail which is non related to this commit. looking forward to your thoughts

@Biki-das Biki-das changed the title Fix:- fixed HMR issue Fix:- Improve HOC support and state preservation in React Refresh Jan 22, 2025
@Biki-das
Copy link
Contributor Author

Overall looks good, and changes make sense, few points:

  • Could you please retitle this PR to something that describes what's being added to Fresh?
  • Could you please add tests that will check that state is not preserved when switching between different wrappers?

also nothing new is added to Fresh, these are the changes

Added special handling for React.forwardRef and React.memo components
Enhanced state preservation logic between updates
Added checks for component type signatures and React component types
Improved family registration for HOCs

@Biki-das Biki-das requested a review from hoxyq January 22, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: React refresh fails when component type is changed to memo or forward ref and vice versa
4 participants