Components: Fix React Compiler error for 'useScrollRectIntoView'#66498
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@Mamaduka unit tests are failing because We could either look into adding global mocks for the whole Gutengerg project, or potentially add extra checks (or optional chaining) in the source code and add a comment explaining the reason for it. |
|
IMHO, those mutations should be allowed by the React Compiler, since all those |
That would be ideal, but the same issue remains with the refs (#29196). I've got a feeling it's a complex problem to resolve, and using |
4ceb079 to
925b5f5
Compare
|
Updated in 925b5f5. |
|
Flaky tests detected in 925b5f5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11624389497
|
| parent.scroll?.( { left: parentScroll - leftOverflow } ); | ||
| } else if ( rightOverflow > 0 ) { | ||
| parent.scrollLeft = parentScroll + rightOverflow; | ||
| parent.scroll?.( { left: parentScroll + rightOverflow } ); |
There was a problem hiding this comment.
Likely the comment might make sense to be here too.
I wonder if we can isolate the logic to a single parent?.scroll() call. Then, it will be just a single comment.
| scrollLeft = parentScroll + rightOverflow; | ||
| } | ||
|
|
||
| if ( scrollLeft !== null ) { |
…dPress#66498) * Components: Fix React Compiler error for 'useScrollRectIntoView' * Use optional chaining and add inline comment * Use single scroll call Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
What?
Part of #61788.
Similar to #66492.
PR fixes React Compiler errors for the
useScrollRectIntoViewhook usingElement.scrollinstead of the shorthand method.Testing Instructions
Smoke test Tabs components in Storybook and editors.