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

test: Update attribute fixture snapshot #24083

Merged
merged 4 commits into from
Apr 5, 2022

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 12, 2022

Summary

Updates the attribute fixture snapshot.

How did you test this change?

  • yarn build --type=UMD_DEV react/index,react-dom && cd fixtures/attribute-behavior && yarn install && yarn start and "save latest results to a file" to fixtures/attribute-behavior/AttributeTableSnapshot.md

@sizebot
Copy link

sizebot commented Mar 12, 2022

Comparing: 061ac27...3d1d243

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 = 130.94 kB 130.94 kB = 41.92 kB 41.92 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 136.01 kB 136.01 kB = 43.40 kB 43.40 kB
facebook-www/ReactDOM-prod.classic.js = 435.49 kB 435.49 kB = 79.78 kB 79.78 kB
facebook-www/ReactDOM-prod.modern.js = 421.91 kB 421.91 kB = 77.76 kB 77.76 kB
facebook-www/ReactDOMForked-prod.classic.js = 435.49 kB 435.49 kB = 79.78 kB 79.78 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 3d1d243

Comment on lines -9790 to +9797
| `src=(true)`| (initial, warning)| `<empty string>` |
| `src=(true)`| (changed, warning, ssr mismatch)| `"http://localhost:3000/true"` |
| `src=(false)`| (initial, warning)| `<empty string>` |
| `src=(string 'true')`| (changed)| `"http://localhost:3000/true"` |
| `src=(string 'false')`| (changed)| `"http://localhost:3000/false"` |
| `src=(string 'on')`| (changed)| `"http://localhost:3000/on"` |
| `src=(string 'off')`| (changed)| `"http://localhost:3000/off"` |
| `src=(symbol)`| (initial, warning)| `<empty string>` |
| `src=(function)`| (initial, warning)| `<empty string>` |
| `src=(symbol)`| (changed, error, warning, ssr mismatch)| `` |
| `src=(function)`| (changed, warning, ssr mismatch)| `"http://localhost:3000/function%20f()%20%7B%7D"` |
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Caused by #23316? /cc @gnoff

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably fine. Basically, all these changes are saying that we'll patch up these attributes on hydration instead of leaving them alone.

Comment on lines -11983 to +11991
| `value=(object)`| (changed, ssr error, ssr mismatch)| `"result of toString()"` |
| `value=(object)`| (changed)| `"result of toString()"` |
| `value=(numeric string)`| (changed)| `"42"` |
| `value=(-1)`| (changed)| `"-1"` |
| `value=(0)`| (changed)| `"0"` |
| `value=(integer)`| (changed)| `"1"` |
| `value=(NaN)`| (changed, warning)| `"NaN"` |
| `value=(float)`| (changed)| `"99.99"` |
| `value=(true)`| (changed, ssr mismatch)| `"true"` |
| `value=(false)`| (changed, ssr mismatch)| `"false"` |
| `value=(true)`| (changed)| `"true"` |
| `value=(false)`| (changed)| `"false"` |
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks fine

Comment on lines -11996 to +11997
| `value=(symbol)`| (initial, warning)| `<empty string>` |
| `value=(function)`| (initial, warning)| `<empty string>` |
| `value=(symbol)`| (initial, warning, ssr error, ssr mismatch)| `<empty string>` |
| `value=(function)`| (initial, warning, ssr mismatch)| `<empty string>` |
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should this be fixed? #24077 fixes these ssr mismatches for <select value />. Can we leverage #24077 to fix this new ssr mismatch as well as the (existing) ssr mismatch for <option value={symbol} />?

Copy link
Collaborator

Choose a reason for hiding this comment

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

What tag is this on? The table doesn't say.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing that's tricky is where we do these conversions. Should they be done by the select tag so that if you provide no option, it should happen anyway. Or should they be done by the option tag when the comparison actually happens.

It probably makes more sense to do them on the select and eagerly convert them to a cloned array of strings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What tag is this on? The table doesn't say.

The expand feature on github.com is broken here. This line is under the "value (on <textarea> inside <div>)" section: https://github.dev/facebook/react/pull/24083#pullrequestreview-909231364

Copy link
Collaborator

@sebmarkbage sebmarkbage Mar 14, 2022

Choose a reason for hiding this comment

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

I see so the change happened in e915eee

The thing is that the fix in #24077 kind of relies on us only toStringing if one if the sides is not defined. I think that the proper fix is to always toString if a value is provided (and always doing so inside the component it is provided so in the select instead of the option for selected value). In other words, if we fix that then maybe we'd actually revert to erroring again.

So I think that it's correct that this errors.

The bug is that the textarea on the client doesn't error by going through getToStringValue. In other words, I think we should revert #13389 and #13362, which trace back to #11741.

My take on the history of this fix is that it was discovered but as Dan pointed out #11734 (comment) it was more consistent now. The original issue remained open and got "fixed" but it didn't need fixing.

We should definitely not silently accept Symbols. It should at least warn. But in general we favor throwing in prod too if it doesn't add perf regressions. In this case we're adding a perf regression to avoid throwing in prod, and cover up bugs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we pretty pervasively check for symbols and silently ignore them for custom props too, which is not great. We should at least add warnings for all those cases and then change it along with other DOM breaking changes we have planned.

I'm not sure if it's worth fixing on the server case. Might as well sneak in a small breakage that we're planning on doing anyway.

@eps1lon eps1lon marked this pull request as ready for review March 12, 2022 08:36
@@ -12018,7 +12018,7 @@
| `value=(string 'false')`| (changed)| `"false"` |
| `value=(string 'on')`| (changed)| `"on"` |
| `value=(string 'off')`| (changed)| `"off"` |
| `value=(symbol)`| (initial, warning, ssr error, ssr mismatch)| `<empty string>` |
| `value=(symbol)`| (initial, warning)| `<empty string>` |
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #24077

@gaearon gaearon merged commit af73043 into facebook:main Apr 5, 2022
@eps1lon eps1lon deleted the test/update-attribute-fixture branch April 5, 2022 07:02
rickhanlonii pushed a commit that referenced this pull request Apr 13, 2022
* test: Update attribute fixture snapshot

* Poke CircleCI

* Poke CircleCI
rickhanlonii pushed a commit that referenced this pull request Apr 14, 2022
* test: Update attribute fixture snapshot

* Poke CircleCI

* Poke CircleCI
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
* test: Update attribute fixture snapshot

* Poke CircleCI

* Poke CircleCI
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.

5 participants