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

Refactor DOM Bindings Completely Off of DOMProperty Meta Programming #26546

Merged
merged 16 commits into from
Apr 4, 2023

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Apr 4, 2023

There are four places we have special cases based off the DOMProperty config:

  1. DEV-only: ReactDOMUnknownPropertyHook warns for passing booleans to non-boolean attributes. We just need a simple list of all properties that are affected by that. We could probably move this in under setProp instead and have it covered by that list.
  2. DEV-only: Hydration. This just needs to read the value from an attribute and compare it to what we'd expect to see if it was rendered on the client. This could use some simplification/unification of the code but I decided to just keep it simple and duplicated since code size isn't an issue.
  3. DOMServerFormatConfig pushAttribute: This just maps the special case to how to emit it as a HTML attribute.
  4. ReactDOMComponent setProp: This just maps the special case to how to emit it as setAttribute or removeAttribute.

Basically we just have to remember to keep pushAttribute and setProp aligned. There's only one long switch in prod per environment.

This just turns it all to a giant simple switch statement with string cases. This is in theory the most optimizable since syntactically all the information for a hash table is there. However, unfortunately we know that most VMs don't optimize this very well and instead just turn them into a bunch of ifs. JSC is best. We can minimize the cost by just moving common attribute to the beginning of the list.

If we shipped this, maybe VMs will get it together to start optimizing this case but there's a chicken and egg problem here and the game theory reality is that we probably don't want to regress. Therefore, I intend to do a follow up after landing this which reintroduces an object indirection for simple property aliases. That should be enough to make the remaining cases palatable. I'll also extract the most common attributes to the beginning or separate ifs.

Ran attribute-behavior fixture and the table is the same.

@sebmarkbage sebmarkbage requested a review from eps1lon April 4, 2023 03:14
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Apr 4, 2023
@react-sizebot
Copy link

react-sizebot commented Apr 4, 2023

Comparing: 7329ea8...69fa0d8

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.min.js +2.13% 162.95 kB 166.41 kB +0.62% 51.54 kB 51.86 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +2.13% 164.48 kB 167.99 kB +0.65% 52.04 kB 52.37 kB
facebook-www/ReactDOM-prod.classic.js +1.39% 553.05 kB 560.75 kB +0.27% 98.24 kB 98.51 kB
facebook-www/ReactDOM-prod.modern.js +1.43% 536.90 kB 544.59 kB +0.30% 95.56 kB 95.85 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.48% 55.58 kB 58.07 kB +1.52% 16.43 kB 16.67 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.48% 55.60 kB 58.09 kB +1.51% 16.45 kB 16.70 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.47% 55.75 kB 58.24 kB +1.03% 16.70 kB 16.87 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.47% 55.77 kB 58.26 kB +1.03% 16.72 kB 16.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +4.46% 56.28 kB 58.78 kB +1.81% 17.31 kB 17.62 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +4.46% 56.30 kB 58.81 kB +1.81% 17.33 kB 17.64 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +4.45% 56.44 kB 58.95 kB +0.82% 17.58 kB 17.72 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +4.45% 56.47 kB 58.98 kB +0.81% 17.60 kB 17.74 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.42% 55.93 kB 58.40 kB +1.52% 16.54 kB 16.80 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.41% 56.10 kB 58.57 kB +1.02% 16.82 kB 16.99 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.production.min.js +4.41% 56.50 kB 59.00 kB +1.80% 17.37 kB 17.68 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +4.40% 56.62 kB 59.12 kB +1.80% 17.42 kB 17.73 kB
oss-experimental/react-dom/cjs/react-dom-static.edge.production.min.js +4.40% 56.69 kB 59.18 kB +1.78% 17.42 kB 17.73 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +4.39% 56.79 kB 59.29 kB +1.05% 17.69 kB 17.88 kB
facebook-www/ReactDOMServer-prod.modern.js +4.33% 128.47 kB 134.03 kB +0.43% 24.25 kB 24.36 kB
facebook-www/ReactDOMServer-prod.classic.js +4.22% 132.03 kB 137.60 kB +0.41% 24.95 kB 25.06 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.min.js +4.21% 59.12 kB 61.61 kB +1.55% 17.85 kB 18.13 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.min.js +4.21% 59.15 kB 61.64 kB +1.56% 17.87 kB 18.15 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +4.17% 133.35 kB 138.92 kB +0.52% 25.50 kB 25.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js +4.17% 60.23 kB 62.74 kB +1.77% 18.60 kB 18.93 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js +4.16% 60.25 kB 62.76 kB +1.78% 18.62 kB 18.95 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.min.js +4.16% 59.54 kB 62.01 kB +1.53% 18.00 kB 18.27 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.14% 60.15 kB 62.64 kB +1.24% 17.90 kB 18.12 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.14% 60.17 kB 62.66 kB +1.25% 17.92 kB 18.14 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js +4.11% 60.64 kB 63.14 kB +1.70% 18.75 kB 19.07 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.09% 60.56 kB 63.04 kB +1.24% 18.05 kB 18.27 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +4.08% 60.49 kB 62.95 kB +1.61% 18.67 kB 18.97 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +4.08% 60.51 kB 62.98 kB +1.61% 18.69 kB 18.99 kB
oss-experimental/react-dom/cjs/react-dom-static.node.production.min.js +4.03% 60.86 kB 63.31 kB +1.70% 18.81 kB 19.13 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +4.03% 60.90 kB 63.35 kB +1.60% 18.81 kB 19.11 kB
oss-experimental/react-dom/umd/react-dom.production.min.js +2.14% 164.39 kB 167.91 kB +0.74% 52.48 kB 52.86 kB
oss-stable-semver/react-dom/umd/react-dom.production.min.js +2.13% 162.78 kB 166.25 kB +0.72% 51.94 kB 52.31 kB
oss-stable/react-dom/umd/react-dom.production.min.js +2.13% 162.85 kB 166.32 kB +0.72% 51.97 kB 52.34 kB
oss-stable-semver/react-dom/cjs/react-dom.production.min.js +2.13% 162.87 kB 166.34 kB +0.62% 51.52 kB 51.84 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.min.js +2.05% 170.70 kB 174.20 kB +0.62% 54.38 kB 54.72 kB
facebook-www/ReactDOM-dev.modern.js +2.05% 1,369.66 kB 1,397.74 kB +0.81% 297.94 kB 300.36 kB
oss-experimental/react-dom/umd/react-dom.profiling.min.js +2.03% 173.36 kB 176.87 kB +0.68% 54.80 kB 55.17 kB
facebook-www/ReactDOMTesting-dev.modern.js +2.02% 1,388.06 kB 1,416.14 kB +0.80% 302.44 kB 304.87 kB
oss-stable-semver/react-dom/umd/react-dom.profiling.min.js +2.02% 171.75 kB 175.22 kB +0.71% 54.25 kB 54.63 kB
oss-stable/react-dom/umd/react-dom.profiling.min.js +2.02% 171.82 kB 175.29 kB +0.71% 54.27 kB 54.66 kB
oss-experimental/react-dom/cjs/react-dom.profiling.min.js +2.01% 174.10 kB 177.61 kB +0.57% 54.48 kB 54.79 kB
oss-stable-semver/react-dom/cjs/react-dom.profiling.min.js +2.01% 172.49 kB 175.96 kB +0.59% 53.99 kB 54.31 kB
facebook-www/ReactDOM-dev.classic.js +2.01% 1,397.40 kB 1,425.47 kB +0.80% 303.52 kB 305.93 kB
oss-stable/react-dom/cjs/react-dom.profiling.min.js +2.01% 172.56 kB 176.03 kB +0.59% 54.02 kB 54.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js = 34.17 kB 31.30 kB = 8.49 kB 7.41 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js = 34.17 kB 31.30 kB = 8.49 kB 7.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js = 68.08 kB 60.82 kB = 16.84 kB 14.72 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js = 68.08 kB 60.82 kB = 16.84 kB 14.72 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.48% 55.58 kB 58.07 kB +1.52% 16.43 kB 16.67 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.48% 55.60 kB 58.09 kB +1.51% 16.45 kB 16.70 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.47% 55.75 kB 58.24 kB +1.03% 16.70 kB 16.87 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.47% 55.77 kB 58.26 kB +1.03% 16.72 kB 16.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +4.46% 56.28 kB 58.78 kB +1.81% 17.31 kB 17.62 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +4.46% 56.30 kB 58.81 kB +1.81% 17.33 kB 17.64 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +4.45% 56.44 kB 58.95 kB +0.82% 17.58 kB 17.72 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +4.45% 56.47 kB 58.98 kB +0.81% 17.60 kB 17.74 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +4.42% 55.93 kB 58.40 kB +1.52% 16.54 kB 16.80 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +4.41% 56.10 kB 58.57 kB +1.02% 16.82 kB 16.99 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.production.min.js +4.41% 56.50 kB 59.00 kB +1.80% 17.37 kB 17.68 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +4.40% 56.62 kB 59.12 kB +1.80% 17.42 kB 17.73 kB
oss-experimental/react-dom/cjs/react-dom-static.edge.production.min.js +4.40% 56.69 kB 59.18 kB +1.78% 17.42 kB 17.73 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +4.39% 56.79 kB 59.29 kB +1.05% 17.69 kB 17.88 kB
facebook-www/ReactDOMServer-prod.modern.js +4.33% 128.47 kB 134.03 kB +0.43% 24.25 kB 24.36 kB
facebook-www/ReactDOMServer-prod.classic.js +4.22% 132.03 kB 137.60 kB +0.41% 24.95 kB 25.06 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.min.js +4.21% 59.12 kB 61.61 kB +1.55% 17.85 kB 18.13 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.min.js +4.21% 59.15 kB 61.64 kB +1.56% 17.87 kB 18.15 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +4.17% 133.35 kB 138.92 kB +0.52% 25.50 kB 25.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js +4.17% 60.23 kB 62.74 kB +1.77% 18.60 kB 18.93 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js +4.16% 60.25 kB 62.76 kB +1.78% 18.62 kB 18.95 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.min.js +4.16% 59.54 kB 62.01 kB +1.53% 18.00 kB 18.27 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.14% 60.15 kB 62.64 kB +1.24% 17.90 kB 18.12 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.14% 60.17 kB 62.66 kB +1.25% 17.92 kB 18.14 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js +4.11% 60.64 kB 63.14 kB +1.70% 18.75 kB 19.07 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +4.09% 60.56 kB 63.04 kB +1.24% 18.05 kB 18.27 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +4.08% 60.49 kB 62.95 kB +1.61% 18.67 kB 18.97 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +4.08% 60.51 kB 62.98 kB +1.61% 18.69 kB 18.99 kB
oss-experimental/react-dom/cjs/react-dom-static.node.production.min.js +4.03% 60.86 kB 63.31 kB +1.70% 18.81 kB 19.13 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +4.03% 60.90 kB 63.35 kB +1.60% 18.81 kB 19.11 kB
oss-experimental/react-dom/umd/react-dom.production.min.js +2.14% 164.39 kB 167.91 kB +0.74% 52.48 kB 52.86 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +2.13% 164.48 kB 167.99 kB +0.65% 52.04 kB 52.37 kB
oss-stable-semver/react-dom/umd/react-dom.production.min.js +2.13% 162.78 kB 166.25 kB +0.72% 51.94 kB 52.31 kB
oss-stable/react-dom/umd/react-dom.production.min.js +2.13% 162.85 kB 166.32 kB +0.72% 51.97 kB 52.34 kB
oss-stable-semver/react-dom/cjs/react-dom.production.min.js +2.13% 162.87 kB 166.34 kB +0.62% 51.52 kB 51.84 kB
oss-stable/react-dom/cjs/react-dom.production.min.js +2.13% 162.95 kB 166.41 kB +0.62% 51.54 kB 51.86 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.min.js +2.05% 170.70 kB 174.20 kB +0.62% 54.38 kB 54.72 kB
facebook-www/ReactDOM-dev.modern.js +2.05% 1,369.66 kB 1,397.74 kB +0.81% 297.94 kB 300.36 kB
oss-experimental/react-dom/umd/react-dom.profiling.min.js +2.03% 173.36 kB 176.87 kB +0.68% 54.80 kB 55.17 kB
facebook-www/ReactDOMTesting-dev.modern.js +2.02% 1,388.06 kB 1,416.14 kB +0.80% 302.44 kB 304.87 kB
oss-stable-semver/react-dom/umd/react-dom.profiling.min.js +2.02% 171.75 kB 175.22 kB +0.71% 54.25 kB 54.63 kB
oss-stable/react-dom/umd/react-dom.profiling.min.js +2.02% 171.82 kB 175.29 kB +0.71% 54.27 kB 54.66 kB
oss-experimental/react-dom/cjs/react-dom.profiling.min.js +2.01% 174.10 kB 177.61 kB +0.57% 54.48 kB 54.79 kB
oss-stable-semver/react-dom/cjs/react-dom.profiling.min.js +2.01% 172.49 kB 175.96 kB +0.59% 53.99 kB 54.31 kB
facebook-www/ReactDOM-dev.classic.js +2.01% 1,397.40 kB 1,425.47 kB +0.80% 303.52 kB 305.93 kB
oss-stable/react-dom/cjs/react-dom.profiling.min.js +2.01% 172.56 kB 176.03 kB +0.59% 54.02 kB 54.33 kB
facebook-www/ReactDOMTesting-dev.classic.js +1.98% 1,415.79 kB 1,443.87 kB +0.75% 307.86 kB 310.18 kB
oss-stable-semver/react-dom/umd/react-dom.development.js +1.83% 1,306.28 kB 1,330.19 kB +0.72% 278.66 kB 280.68 kB
oss-stable/react-dom/umd/react-dom.development.js +1.83% 1,306.30 kB 1,330.22 kB +0.72% 278.69 kB 280.70 kB
oss-experimental/react-dom/umd/react-dom.development.js +1.82% 1,317.82 kB 1,341.75 kB +0.77% 280.50 kB 282.66 kB
oss-stable-semver/react-dom/cjs/react-dom.development.js +1.79% 1,246.18 kB 1,268.54 kB +0.76% 275.68 kB 277.78 kB
oss-stable/react-dom/cjs/react-dom.development.js +1.79% 1,246.21 kB 1,268.57 kB +0.76% 275.70 kB 277.81 kB
oss-experimental/react-dom/cjs/react-dom.development.js +1.78% 1,257.13 kB 1,279.50 kB +0.80% 277.58 kB 279.81 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +1.75% 1,275.24 kB 1,297.61 kB +0.79% 282.04 kB 284.26 kB
facebook-www/ReactDOM-prod.modern.js +1.43% 536.90 kB 544.59 kB +0.30% 95.56 kB 95.85 kB
facebook-www/ReactDOM-prod.classic.js +1.39% 553.05 kB 560.75 kB +0.27% 98.24 kB 98.51 kB
facebook-www/ReactDOMTesting-prod.modern.js +1.39% 553.44 kB 561.13 kB +0.32% 99.71 kB 100.03 kB
facebook-www/ReactDOM-profiling.modern.js +1.36% 567.29 kB 574.98 kB +0.30% 100.04 kB 100.34 kB
facebook-www/ReactDOMTesting-prod.classic.js +1.35% 567.77 kB 575.45 kB +0.26% 101.93 kB 102.19 kB
facebook-www/ReactDOM-profiling.classic.js +1.32% 583.51 kB 591.20 kB +0.24% 102.81 kB 103.06 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +0.74% 369.48 kB 372.22 kB = 79.56 kB 79.36 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +0.74% 369.50 kB 372.25 kB = 79.58 kB 79.38 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +0.74% 370.33 kB 373.08 kB = 79.48 kB 79.26 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +0.74% 370.36 kB 373.10 kB = 79.50 kB 79.28 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +0.74% 371.65 kB 374.38 kB = 80.10 kB 79.88 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +0.73% 372.51 kB 375.24 kB = 80.02 kB 79.79 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js +0.65% 350.68 kB 352.96 kB = 78.01 kB 77.79 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js +0.65% 350.70 kB 352.99 kB = 78.03 kB 77.82 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.65% 352.85 kB 355.14 kB = 78.67 kB 78.47 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.65% 352.88 kB 355.16 kB = 78.69 kB 78.49 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +0.65% 352.99 kB 355.28 kB = 78.72 kB 78.52 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +0.65% 353.01 kB 355.30 kB = 78.75 kB 78.54 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.65% 353.69 kB 355.98 kB = 78.60 kB 78.40 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.65% 353.71 kB 356.00 kB = 78.62 kB 78.42 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.65% 354.22 kB 356.51 kB = 78.66 kB 78.47 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.65% 354.25 kB 356.53 kB = 78.68 kB 78.49 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js +0.65% 352.74 kB 355.02 kB = 78.59 kB 78.35 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +0.64% 355.45 kB 357.73 kB = 79.06 kB 78.86 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +0.64% 355.47 kB 357.76 kB = 79.08 kB 78.88 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.development.js +0.64% 354.22 kB 356.50 kB = 79.07 kB 78.83 kB
oss-experimental/react-dom/cjs/react-dom-static.edge.development.js +0.64% 354.36 kB 356.64 kB = 79.12 kB 78.88 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +0.64% 354.91 kB 357.19 kB = 79.25 kB 79.02 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js +0.64% 355.05 kB 357.33 kB = 79.30 kB 79.07 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.64% 355.75 kB 358.03 kB = 79.17 kB 78.95 kB
oss-experimental/react-dom/cjs/react-dom-static.node.development.js +0.64% 356.24 kB 358.52 kB = 79.32 kB 79.10 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.64% 356.28 kB 358.56 kB = 79.24 kB 79.02 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +0.64% 357.51 kB 359.78 kB = 79.62 kB 79.42 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +0.48% 359.58 kB 361.32 kB = 78.36 kB 78.16 kB
facebook-www/ReactDOMServer-dev.modern.js +0.48% 364.68 kB 366.42 kB = 79.65 kB 79.44 kB
facebook-www/ReactDOMServer-dev.classic.js +0.47% 372.10 kB 373.84 kB = 81.26 kB 81.05 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 97.93 kB 91.01 kB = 23.95 kB 21.91 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 99.95 kB 92.85 kB = 23.74 kB 21.68 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 96.54 kB 89.62 kB = 23.57 kB 21.53 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 95.39 kB 88.48 kB = 23.59 kB 21.55 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 94.90 kB 87.99 kB = 23.44 kB 21.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js = 27.44 kB 25.19 kB = 9.39 kB 8.45 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js = 27.20 kB 24.95 kB = 9.28 kB 8.35 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js = 34.17 kB 31.30 kB = 8.49 kB 7.41 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js = 34.17 kB 31.30 kB = 8.49 kB 7.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js = 26.56 kB 24.31 kB = 9.10 kB 8.16 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js = 26.49 kB 24.23 kB = 9.11 kB 8.16 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js = 26.28 kB 24.02 kB = 9.00 kB 8.07 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js = 68.08 kB 60.82 kB = 16.84 kB 14.72 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js = 68.08 kB 60.82 kB = 16.84 kB 14.72 kB

Generated by 🚫 dangerJS against 69fa0d8

props: any,
): void {
switch (key) {
case 'style': {
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Apr 4, 2023

Choose a reason for hiding this comment

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

This is a replica of the beginning of setProp. We can probably unify some of this.

Copy link
Collaborator

@sophiebits sophiebits left a comment

Choose a reason for hiding this comment

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

is this what makes you happy?

}
case 'suppressContentEditableWarning':
case 'suppressHydrationWarning':
case 'innerHTML': {
Copy link
Collaborator

Choose a reason for hiding this comment

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

:o since when is innerHTML reserved

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's been reserved forever basically. It became more critical with the Custom Element convention which looks for existing properties and use them if available. Since that will be allowing plain innerHTML without using dangerouslySetInnerHTML.

case 'innerHTML': {
// Noop
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is no longer skipping defaultValue defaultChecked autoFocus and no longer setting multiple muted technically a breaking change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea but probably fine. Since this path is no longer taken for is etc where this might be relevant in the weird overlap between input and is. Seems unlikely people rely on defaultValue as an attribute. As a property is not officially shipped yet so not breaking.

autoFocus is interesting because I noticed that we only allow it on specific elements, and not for example something with a tabIndex on it which seems like an existing React bug. So actually setting autoFocus can at least give you a chance to handle that in the custom element.

multiple and muted will be reinstated to optionally use properties with the enableCustomElementPropertySupport flag on.

}
break;
}
case 'rowSpan':
Copy link
Collaborator

Choose a reason for hiding this comment

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

wait why do we have special behavior for rowSpan and not colSpan

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You tell me. Turns out you added rowSpan as a numeric but not colSpan. Probably just an oversight?

6269ef6

@sebmarkbage
Copy link
Collaborator Author

is this what makes you happy?

Unreasonably so. It makes me feel empowered when I can follow the cost for each case.

@sebmarkbage sebmarkbage merged commit eeabb73 into facebook:main Apr 4, 2023
github-actions bot pushed a commit that referenced this pull request Apr 4, 2023
…26546)

There are four places we have special cases based off the DOMProperty
config:

1) DEV-only: ReactDOMUnknownPropertyHook warns for passing booleans to
non-boolean attributes. We just need a simple list of all properties
that are affected by that. We could probably move this in under setProp
instead and have it covered by that list.
2) DEV-only: Hydration. This just needs to read the value from an
attribute and compare it to what we'd expect to see if it was rendered
on the client. This could use some simplification/unification of the
code but I decided to just keep it simple and duplicated since code size
isn't an issue.
3) DOMServerFormatConfig pushAttribute: This just maps the special case
to how to emit it as a HTML attribute.
4) ReactDOMComponent setProp: This just maps the special case to how to
emit it as setAttribute or removeAttribute.

Basically we just have to remember to keep pushAttribute and setProp
aligned. There's only one long switch in prod per environment.

This just turns it all to a giant simple switch statement with string
cases. This is in theory the most optimizable since syntactically all
the information for a hash table is there. However, unfortunately we
know that most VMs don't optimize this very well and instead just turn
them into a bunch of ifs. JSC is best. We can minimize the cost by just
moving common attribute to the beginning of the list.

If we shipped this, maybe VMs will get it together to start optimizing
this case but there's a chicken and egg problem here and the game theory
reality is that we probably don't want to regress. Therefore, I intend
to do a follow up after landing this which reintroduces an object
indirection for simple property aliases. That should be enough to make
the remaining cases palatable. I'll also extract the most common
attributes to the beginning or separate ifs.

Ran attribute-behavior fixture and the table is the same.

DiffTrain build for [eeabb73](eeabb73)
sebmarkbage added a commit that referenced this pull request Apr 4, 2023
This is a follow up to #26546

This is strictly a perf optimization since we know that switches over
strings aren't optimally implemented in current engines. Basically
they're a sequence of ifs.

As a result, we're better off putting the unusual cases in a Map and the
very common cases in the beginning of the switch. We might be better off
putting very common cases in explicit ifs - just in case the engine does
optimize switches to a hash table which is potentially worse.

---------

Co-authored-by: Sophie Alpert <git@sophiebits.com>
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Apr 13, 2023
Summary:
This sync includes the following changes:
- **[58742c21b](facebook/react@58742c21b )**: Delete unused `eventTimes` Fiber field ([#26599](facebook/react#26599)) //<Andrew Clark>//
- **[0b931f90e](facebook/react@0b931f90e )**: Remove JND delay for non-transition updates ([#26597](facebook/react#26597)) //<Andrew Clark>//
- **[ac43bf687](facebook/react@ac43bf687 )**: Move validation of text nesting into ReactDOMComponent  ([#26594](facebook/react#26594)) //<Sebastian Markbåge>//
- **[ca41adb8c](facebook/react@ca41adb8c )**: Diff properties in the commit phase instead of generating an update payload ([#26583](facebook/react#26583)) //<Sebastian Markbåge>//
- **[dd0619b2e](facebook/react@dd0619b2e )**: rename $$$hostConfig to $$$config ([#26593](facebook/react#26593)) //<Josh Story>//
- **[b55d31955](facebook/react@b55d31955 )**: Rename HostConfig files to FiberConfig to clarify they are configs fo… ([#26592](facebook/react#26592)) //<Josh Story>//
- **[ffb8eaca5](facebook/react@ffb8eaca5 )**: Rename ReactServerFormatConfig to ReactFizzConfig ([#26591](facebook/react#26591)) //<Josh Story>//
- **[f4f873f62](facebook/react@f4f873f62 )**: Implements wiring for Flight to have it's own "HostConfig" ([#26590](facebook/react#26590)) //<Josh Story>//
- **[44db16afc](facebook/react@44db16afc )**: Normalize ReactFlightServerConfig and related files ([#26589](facebook/react#26589)) //<Josh Story>//
- **[fec97ecbc](facebook/react@fec97ecbc )**: act: Move didScheduleLegacyUpdate to ensureRootIsScheduled ([#26552](facebook/react#26552)) //<Andrew Clark>//
- **[9a9da7721](facebook/react@9a9da7721 )**: Don't update textarea defaultValue and input checked unnecessarily ([#26580](facebook/react#26580)) //<Sebastian Markbåge>//
- **[e5146cb52](facebook/react@e5146cb52 )**: Refactor some controlled component stuff ([#26573](facebook/react#26573)) //<Sebastian Markbåge>//
- **[657698e48](facebook/react@657698e48 )**: [Tests] `waitForThrow` should diff strings ([#26568](facebook/react#26568)) //<Josh Story>//
- **[85bb7b685](facebook/react@85bb7b685 )**: Fix: Move `destroy` field to shared instance object ([#26561](facebook/react#26561)) //<Andrew Clark>//
- **[9cfba0f6e](facebook/react@9cfba0f6e )**: Clean up discrete event replaying ([#26558](facebook/react#26558)) //<Sebastian Markbåge>//
- **[790ebc962](facebook/react@790ebc962 )**: Remove no-fallthrough lint suppressions ([#26553](facebook/react#26553)) //<Sophie Alpert>//
- **[c15579631](facebook/react@c15579631 )**: Put common aliases in Map/Set instead of switch over strings ([#26551](facebook/react#26551)) //<Sebastian Markbåge>//
- **[d5fd60f7e](facebook/react@d5fd60f7e )**: Remove findInstanceBlockingEvent unused parameters ([#26534](facebook/react#26534)) //<Mohammad Ghorbani>//
- **[eeabb7312](facebook/react@eeabb7312 )**: Refactor DOM Bindings Completely Off of DOMProperty Meta Programming ([#26546](facebook/react#26546)) //<Sebastian Markbåge>//
- **[da94e8b24](facebook/react@da94e8b24 )**: Revert "Cleanup enableSyncDefaultUpdate flag ([#26236](facebook/react#26236))" ([#26528](facebook/react#26528)) //<Jan Kassens>//
- **[0700dd50b](facebook/react@0700dd50b )**: Implement public instances for text nodes in Fabric ([#26516](facebook/react#26516)) //<Rubén Norte>//
- **[4a1cc2ddd](facebook/react@4a1cc2ddd )**: Fix logic around attribute seralization ([#26526](facebook/react#26526)) //<Josh Story>//
- **[7329ea81c](facebook/react@7329ea81c )**: Fix suspense replaying forward refs ([#26535](facebook/react#26535)) //<Hans Otto Wirtz>//
- **[0ae348018](facebook/react@0ae348018 )**: [Float] Suspend unstyled content for up to 1 minute ([#26532](facebook/react#26532)) //<Andrew Clark>//
- **[888874673](facebook/react@888874673 )**: Allow transitions to interrupt Suspensey commits ([#26531](facebook/react#26531)) //<Andrew Clark>//
- **[09c8d2563](facebook/react@09c8d2563 )**: Move update scheduling to microtask ([#26512](facebook/react#26512)) //<Andrew Clark>//
- **[8310854ce](facebook/react@8310854ce )**: Clean up enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ([#26521](facebook/react#26521)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions ca01f35...58742c2

jest_e2e[run_all_tests]
bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44872333

fbshipit-source-id: 0695e86645955aac7a20afdaf3ed02ad33592f5c
sophiebits added a commit to sophiebits/react that referenced this pull request Apr 14, 2023
Since this is an observable behavior and is hard to think about, seems good to have tests for this.

The expected value included in each test is the behavior that existed prior to facebook#26546.
sophiebits added a commit to sophiebits/react that referenced this pull request Apr 14, 2023
Since this is an observable behavior and is hard to think about, seems good to have tests for this.

The expected value included in each test is the behavior that existed prior to facebook#26546.
kassens added a commit to kassens/react that referenced this pull request Apr 17, 2023
sophiebits added a commit to sophiebits/react that referenced this pull request Apr 18, 2023
Since this is an observable behavior and is hard to think about, seems good to have tests for this.

The expected value included in each test is the behavior that existed prior to facebook#26546.
sophiebits added a commit that referenced this pull request Apr 18, 2023
Since this is an observable behavior and is hard to think about, seems
good to have tests for this.

The expected value included in each test is the behavior that existed
prior to #26546.
kassens added a commit that referenced this pull request Apr 20, 2023
github-actions bot pushed a commit that referenced this pull request Apr 20, 2023
kassens added a commit that referenced this pull request Apr 20, 2023
kassens added a commit that referenced this pull request Apr 20, 2023
kassens pushed a commit that referenced this pull request Apr 21, 2023
Since this is an observable behavior and is hard to think about, seems
good to have tests for this.

The expected value included in each test is the behavior that existed
prior to #26546.
jeongshin pushed a commit to jeongshin/react-native that referenced this pull request May 7, 2023
Summary:
This sync includes the following changes:
- **[58742c21b](facebook/react@58742c21b )**: Delete unused `eventTimes` Fiber field ([facebook#26599](facebook/react#26599)) //<Andrew Clark>//
- **[0b931f90e](facebook/react@0b931f90e )**: Remove JND delay for non-transition updates ([facebook#26597](facebook/react#26597)) //<Andrew Clark>//
- **[ac43bf687](facebook/react@ac43bf687 )**: Move validation of text nesting into ReactDOMComponent  ([facebook#26594](facebook/react#26594)) //<Sebastian Markbåge>//
- **[ca41adb8c](facebook/react@ca41adb8c )**: Diff properties in the commit phase instead of generating an update payload ([facebook#26583](facebook/react#26583)) //<Sebastian Markbåge>//
- **[dd0619b2e](facebook/react@dd0619b2e )**: rename $$$hostConfig to $$$config ([facebook#26593](facebook/react#26593)) //<Josh Story>//
- **[b55d31955](facebook/react@b55d31955 )**: Rename HostConfig files to FiberConfig to clarify they are configs fo… ([facebook#26592](facebook/react#26592)) //<Josh Story>//
- **[ffb8eaca5](facebook/react@ffb8eaca5 )**: Rename ReactServerFormatConfig to ReactFizzConfig ([facebook#26591](facebook/react#26591)) //<Josh Story>//
- **[f4f873f62](facebook/react@f4f873f62 )**: Implements wiring for Flight to have it's own "HostConfig" ([facebook#26590](facebook/react#26590)) //<Josh Story>//
- **[44db16afc](facebook/react@44db16afc )**: Normalize ReactFlightServerConfig and related files ([facebook#26589](facebook/react#26589)) //<Josh Story>//
- **[fec97ecbc](facebook/react@fec97ecbc )**: act: Move didScheduleLegacyUpdate to ensureRootIsScheduled ([facebook#26552](facebook/react#26552)) //<Andrew Clark>//
- **[9a9da7721](facebook/react@9a9da7721 )**: Don't update textarea defaultValue and input checked unnecessarily ([facebook#26580](facebook/react#26580)) //<Sebastian Markbåge>//
- **[e5146cb52](facebook/react@e5146cb52 )**: Refactor some controlled component stuff ([facebook#26573](facebook/react#26573)) //<Sebastian Markbåge>//
- **[657698e48](facebook/react@657698e48 )**: [Tests] `waitForThrow` should diff strings ([facebook#26568](facebook/react#26568)) //<Josh Story>//
- **[85bb7b685](facebook/react@85bb7b685 )**: Fix: Move `destroy` field to shared instance object ([facebook#26561](facebook/react#26561)) //<Andrew Clark>//
- **[9cfba0f6e](facebook/react@9cfba0f6e )**: Clean up discrete event replaying ([facebook#26558](facebook/react#26558)) //<Sebastian Markbåge>//
- **[790ebc962](facebook/react@790ebc962 )**: Remove no-fallthrough lint suppressions ([facebook#26553](facebook/react#26553)) //<Sophie Alpert>//
- **[c15579631](facebook/react@c15579631 )**: Put common aliases in Map/Set instead of switch over strings ([facebook#26551](facebook/react#26551)) //<Sebastian Markbåge>//
- **[d5fd60f7e](facebook/react@d5fd60f7e )**: Remove findInstanceBlockingEvent unused parameters ([facebook#26534](facebook/react#26534)) //<Mohammad Ghorbani>//
- **[eeabb7312](facebook/react@eeabb7312 )**: Refactor DOM Bindings Completely Off of DOMProperty Meta Programming ([facebook#26546](facebook/react#26546)) //<Sebastian Markbåge>//
- **[da94e8b24](facebook/react@da94e8b24 )**: Revert "Cleanup enableSyncDefaultUpdate flag ([facebook#26236](facebook/react#26236))" ([facebook#26528](facebook/react#26528)) //<Jan Kassens>//
- **[0700dd50b](facebook/react@0700dd50b )**: Implement public instances for text nodes in Fabric ([facebook#26516](facebook/react#26516)) //<Rubén Norte>//
- **[4a1cc2ddd](facebook/react@4a1cc2ddd )**: Fix logic around attribute seralization ([facebook#26526](facebook/react#26526)) //<Josh Story>//
- **[7329ea81c](facebook/react@7329ea81c )**: Fix suspense replaying forward refs ([facebook#26535](facebook/react#26535)) //<Hans Otto Wirtz>//
- **[0ae348018](facebook/react@0ae348018 )**: [Float] Suspend unstyled content for up to 1 minute ([facebook#26532](facebook/react#26532)) //<Andrew Clark>//
- **[888874673](facebook/react@888874673 )**: Allow transitions to interrupt Suspensey commits ([facebook#26531](facebook/react#26531)) //<Andrew Clark>//
- **[09c8d2563](facebook/react@09c8d2563 )**: Move update scheduling to microtask ([facebook#26512](facebook/react#26512)) //<Andrew Clark>//
- **[8310854ce](facebook/react@8310854ce )**: Clean up enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ([facebook#26521](facebook/react#26521)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions ca01f35...58742c2

jest_e2e[run_all_tests]
bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44872333

fbshipit-source-id: 0695e86645955aac7a20afdaf3ed02ad33592f5c
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This sync includes the following changes:
- **[58742c21b](facebook/react@58742c21b )**: Delete unused `eventTimes` Fiber field ([facebook#26599](facebook/react#26599)) //<Andrew Clark>//
- **[0b931f90e](facebook/react@0b931f90e )**: Remove JND delay for non-transition updates ([facebook#26597](facebook/react#26597)) //<Andrew Clark>//
- **[ac43bf687](facebook/react@ac43bf687 )**: Move validation of text nesting into ReactDOMComponent  ([facebook#26594](facebook/react#26594)) //<Sebastian Markbåge>//
- **[ca41adb8c](facebook/react@ca41adb8c )**: Diff properties in the commit phase instead of generating an update payload ([facebook#26583](facebook/react#26583)) //<Sebastian Markbåge>//
- **[dd0619b2e](facebook/react@dd0619b2e )**: rename $$$hostConfig to $$$config ([facebook#26593](facebook/react#26593)) //<Josh Story>//
- **[b55d31955](facebook/react@b55d31955 )**: Rename HostConfig files to FiberConfig to clarify they are configs fo… ([facebook#26592](facebook/react#26592)) //<Josh Story>//
- **[ffb8eaca5](facebook/react@ffb8eaca5 )**: Rename ReactServerFormatConfig to ReactFizzConfig ([facebook#26591](facebook/react#26591)) //<Josh Story>//
- **[f4f873f62](facebook/react@f4f873f62 )**: Implements wiring for Flight to have it's own "HostConfig" ([facebook#26590](facebook/react#26590)) //<Josh Story>//
- **[44db16afc](facebook/react@44db16afc )**: Normalize ReactFlightServerConfig and related files ([facebook#26589](facebook/react#26589)) //<Josh Story>//
- **[fec97ecbc](facebook/react@fec97ecbc )**: act: Move didScheduleLegacyUpdate to ensureRootIsScheduled ([facebook#26552](facebook/react#26552)) //<Andrew Clark>//
- **[9a9da7721](facebook/react@9a9da7721 )**: Don't update textarea defaultValue and input checked unnecessarily ([facebook#26580](facebook/react#26580)) //<Sebastian Markbåge>//
- **[e5146cb52](facebook/react@e5146cb52 )**: Refactor some controlled component stuff ([facebook#26573](facebook/react#26573)) //<Sebastian Markbåge>//
- **[657698e48](facebook/react@657698e48 )**: [Tests] `waitForThrow` should diff strings ([facebook#26568](facebook/react#26568)) //<Josh Story>//
- **[85bb7b685](facebook/react@85bb7b685 )**: Fix: Move `destroy` field to shared instance object ([facebook#26561](facebook/react#26561)) //<Andrew Clark>//
- **[9cfba0f6e](facebook/react@9cfba0f6e )**: Clean up discrete event replaying ([facebook#26558](facebook/react#26558)) //<Sebastian Markbåge>//
- **[790ebc962](facebook/react@790ebc962 )**: Remove no-fallthrough lint suppressions ([facebook#26553](facebook/react#26553)) //<Sophie Alpert>//
- **[c15579631](facebook/react@c15579631 )**: Put common aliases in Map/Set instead of switch over strings ([facebook#26551](facebook/react#26551)) //<Sebastian Markbåge>//
- **[d5fd60f7e](facebook/react@d5fd60f7e )**: Remove findInstanceBlockingEvent unused parameters ([facebook#26534](facebook/react#26534)) //<Mohammad Ghorbani>//
- **[eeabb7312](facebook/react@eeabb7312 )**: Refactor DOM Bindings Completely Off of DOMProperty Meta Programming ([facebook#26546](facebook/react#26546)) //<Sebastian Markbåge>//
- **[da94e8b24](facebook/react@da94e8b24 )**: Revert "Cleanup enableSyncDefaultUpdate flag ([facebook#26236](facebook/react#26236))" ([facebook#26528](facebook/react#26528)) //<Jan Kassens>//
- **[0700dd50b](facebook/react@0700dd50b )**: Implement public instances for text nodes in Fabric ([facebook#26516](facebook/react#26516)) //<Rubén Norte>//
- **[4a1cc2ddd](facebook/react@4a1cc2ddd )**: Fix logic around attribute seralization ([facebook#26526](facebook/react#26526)) //<Josh Story>//
- **[7329ea81c](facebook/react@7329ea81c )**: Fix suspense replaying forward refs ([facebook#26535](facebook/react#26535)) //<Hans Otto Wirtz>//
- **[0ae348018](facebook/react@0ae348018 )**: [Float] Suspend unstyled content for up to 1 minute ([facebook#26532](facebook/react#26532)) //<Andrew Clark>//
- **[888874673](facebook/react@888874673 )**: Allow transitions to interrupt Suspensey commits ([facebook#26531](facebook/react#26531)) //<Andrew Clark>//
- **[09c8d2563](facebook/react@09c8d2563 )**: Move update scheduling to microtask ([facebook#26512](facebook/react#26512)) //<Andrew Clark>//
- **[8310854ce](facebook/react@8310854ce )**: Clean up enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ([facebook#26521](facebook/react#26521)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions ca01f35...58742c2

jest_e2e[run_all_tests]
bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44872333

fbshipit-source-id: 0695e86645955aac7a20afdaf3ed02ad33592f5c
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…acebook#26546)

There are four places we have special cases based off the DOMProperty
config:

1) DEV-only: ReactDOMUnknownPropertyHook warns for passing booleans to
non-boolean attributes. We just need a simple list of all properties
that are affected by that. We could probably move this in under setProp
instead and have it covered by that list.
2) DEV-only: Hydration. This just needs to read the value from an
attribute and compare it to what we'd expect to see if it was rendered
on the client. This could use some simplification/unification of the
code but I decided to just keep it simple and duplicated since code size
isn't an issue.
3) DOMServerFormatConfig pushAttribute: This just maps the special case
to how to emit it as a HTML attribute.
4) ReactDOMComponent setProp: This just maps the special case to how to
emit it as setAttribute or removeAttribute.

Basically we just have to remember to keep pushAttribute and setProp
aligned. There's only one long switch in prod per environment.

This just turns it all to a giant simple switch statement with string
cases. This is in theory the most optimizable since syntactically all
the information for a hash table is there. However, unfortunately we
know that most VMs don't optimize this very well and instead just turn
them into a bunch of ifs. JSC is best. We can minimize the cost by just
moving common attribute to the beginning of the list.

If we shipped this, maybe VMs will get it together to start optimizing
this case but there's a chicken and egg problem here and the game theory
reality is that we probably don't want to regress. Therefore, I intend
to do a follow up after landing this which reintroduces an object
indirection for simple property aliases. That should be enough to make
the remaining cases palatable. I'll also extract the most common
attributes to the beginning or separate ifs.

Ran attribute-behavior fixture and the table is the same.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…k#26551)

This is a follow up to facebook#26546

This is strictly a perf optimization since we know that switches over
strings aren't optimally implemented in current engines. Basically
they're a sequence of ifs.

As a result, we're better off putting the unusual cases in a Map and the
very common cases in the beginning of the switch. We might be better off
putting very common cases in explicit ifs - just in case the engine does
optimize switches to a hash table which is potentially worse.

---------

Co-authored-by: Sophie Alpert <git@sophiebits.com>
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
Since this is an observable behavior and is hard to think about, seems
good to have tests for this.

The expected value included in each test is the behavior that existed
prior to facebook#26546.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
…26546)

There are four places we have special cases based off the DOMProperty
config:

1) DEV-only: ReactDOMUnknownPropertyHook warns for passing booleans to
non-boolean attributes. We just need a simple list of all properties
that are affected by that. We could probably move this in under setProp
instead and have it covered by that list.
2) DEV-only: Hydration. This just needs to read the value from an
attribute and compare it to what we'd expect to see if it was rendered
on the client. This could use some simplification/unification of the
code but I decided to just keep it simple and duplicated since code size
isn't an issue.
3) DOMServerFormatConfig pushAttribute: This just maps the special case
to how to emit it as a HTML attribute.
4) ReactDOMComponent setProp: This just maps the special case to how to
emit it as setAttribute or removeAttribute.

Basically we just have to remember to keep pushAttribute and setProp
aligned. There's only one long switch in prod per environment.

This just turns it all to a giant simple switch statement with string
cases. This is in theory the most optimizable since syntactically all
the information for a hash table is there. However, unfortunately we
know that most VMs don't optimize this very well and instead just turn
them into a bunch of ifs. JSC is best. We can minimize the cost by just
moving common attribute to the beginning of the list.

If we shipped this, maybe VMs will get it together to start optimizing
this case but there's a chicken and egg problem here and the game theory
reality is that we probably don't want to regress. Therefore, I intend
to do a follow up after landing this which reintroduces an object
indirection for simple property aliases. That should be enough to make
the remaining cases palatable. I'll also extract the most common
attributes to the beginning or separate ifs.

Ran attribute-behavior fixture and the table is the same.

DiffTrain build for commit eeabb73.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
Since this is an observable behavior and is hard to think about, seems
good to have tests for this.

The expected value included in each test is the behavior that existed
prior to #26546.

DiffTrain build for commit 1b4a0da.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants