-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Move createElement/JSX Warnings into the Renderer #29088
Commits on May 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bde00cc - Browse repository at this point
Copy the full SHA bde00ccView commit details -
Remove extra stack frame addendum indirections
Eventually we should be able to delete describeUnknownElementTypeFrameInDEV since it only has this one callsite.
Configuration menu - View commit details
-
Copy full SHA for 8086702 - Browse repository at this point
Copy the full SHA 8086702View commit details -
Don't validate element type in createElement/JSX
We validate these in the renderers inherently anyway and the renderers are the only ones that really knows what a valid type for that renderer is. For example the Client Reference check isn't valid for all kinds of configs in Flight. Also, a lot of the checks for valid elements are not valid in Flight e.g. class components. The only reason to do this validation early is because it provides a better stack trace of the callsite for context. However, that's a general problem and the whole point of enableOwnerStacks that it solves this for all kinds of late errors. For now I keep the early validation when enableOwnerStacks is off because in that case we don't have a good stack (but to be fair we don't for any other error neither). Once it is further rolled out we can delete these fully.
Configuration menu - View commit details
-
Copy full SHA for c359809 - Browse repository at this point
Copy the full SHA c359809View commit details -
Don't validate keys in createElement/JSX
We have the same validation in the reconciler and with enableOwnerStacks we'll have the ability to provide a stack trace with the callsite of the element. The way the validation works is that if something is passed through a valid static slot, an element gets marked as valid. If it has been logged as errored before, it gets logged as valid so that future logs don't happen. This change logs for strictly fewer cases - specifically if an element doesn't get rendered/mounted at all. I updated some tests to start rendering where it didn't before.
Configuration menu - View commit details
-
Copy full SHA for 90971dc - Browse repository at this point
Copy the full SHA 90971dcView commit details -
Mark child for force warning if assigned implicit key
When React.Children assigns an implicit key we should still warn when the original element should've had a key since if was in an array. This marks such elements as having failed validation even if they have a key so that the error can later be logged in the renderer.
Configuration menu - View commit details
-
Copy full SHA for 8f6c117 - Browse repository at this point
Copy the full SHA 8f6c117View commit details -
This is just additional for running warnings in the server logs in addition to the ones that happen during hydration but it's good to have both for parity and being able to fail SSR tests early. This also demonstrates per request warning deduping so that they don't just happen once when the server remains alive.
Configuration menu - View commit details
-
Copy full SHA for caa9078 - Browse repository at this point
Copy the full SHA caa9078View commit details -
Elements that render Server Components are validated inside Flight. Others pass the validated flag to the client. Instead of running validation in certain cases (block list) we're marking all the cases that don't need keys (allow list) which is tricky since we need to cover all cases. This might lead to false warnings.
Configuration menu - View commit details
-
Copy full SHA for 06a041a - Browse repository at this point
Copy the full SHA 06a041aView commit details -
Key warnings are no longer associated with a component in the tree
Key warnings are supposed to be associated with the child missing the key. It was previously associated with the owner of the parent element which is not really as useful but now it's unfortunately associated with a fake fiber which disappears.
Configuration menu - View commit details
-
Copy full SHA for 047439c - Browse repository at this point
Copy the full SHA 047439cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 43ceacd - Browse repository at this point
Copy the full SHA 43ceacdView commit details