-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Simplify zoom out animation trigger #67533
base: trunk
Are you sure you want to change the base?
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. |
Size Change: -24 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
524c772
to
e6ff0fe
Compare
Flaky tests detected in e6ff0fe. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12144080449
|
e6ff0fe
to
8d93ba3
Compare
if ( scaleValue < 1 ) { | ||
if ( isZoomedOut ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I note the original conditional was scaleValue < 1
and now the conditional is scale !== 1
.
Was that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl;dr: I think it's fine to use isZoomedOut
here.
We can't check scale < 1
directly because scale
could be the string auto-scaled
.
The intention for this line before was to check for isZoomedOut
, but we didn't want the useEffect
to run when that changed. So, we used scaleValue
and didn't notice the checks were different. I think using isZoomedOut
here is better than the check before since it will always be the same result instead of having two different checks for the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well! Glad this is finally combined into one useEffect
! 👏🏻
if ( scaleValue < 1 ) { | ||
if ( isZoomedOut ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl;dr: I think it's fine to use isZoomedOut
here.
We can't check scale < 1
directly because scale
could be the string auto-scaled
.
The intention for this line before was to check for isZoomedOut
, but we didn't want the useEffect
to run when that changed. So, we used scaleValue
and didn't notice the checks were different. I think using isZoomedOut
here is better than the check before since it will always be the same result instead of having two different checks for the same thing.
if ( ! isZoomedOut ) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like the early return to show that we're not doing anything if we're not zoomed out. Could we add this to the combined useEffect
to make it clearer it doesn't do anything if we're not zoomed out?
What?
Simplifies the zoom out animation trigger.
Why?
Code quality.
How?
Since we're no longer relying on the
useEffect
dependencies to trigger the animation, we can consolidate that effect into the main one.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast