Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function ZoomOutModeInserters() {
}
// reset insertion point when the block order changes
setInserterIsOpened( true );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ blockOrder ] );
}, [ blockOrder, setInserterIsOpened ] );
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure I added this because it was misbehaving, but I can't remember after all the changes. What happens theoretically when the function changes? We only want to reset it when the order changes, so maybe we have to check that in the effect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will this ever happen? It looks like a stable reference to me, so I don't understand when it will change. Plus we also have the mounted check. Happy to abandon it if I'm missing something of course.

Copy link
Member

Choose a reason for hiding this comment

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

Right, actions should be safe to list in dependencies. If they're not anymore, we might have a bigger problem 😅

P.S. It would be cool if linter treated Redux actions as state setters, but IIRC that involved a lot of work.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, if everything works fine. I could swear I added it for a reason 😅

Copy link
Member

Choose a reason for hiding this comment

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

We don't know it's an action though, it's a setting, right? I don't love these "impure" dependencies that much tbh

Copy link
Member

Choose a reason for hiding this comment

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

Yes. It's a setting pointing to the Editor package's setIsInserterOpened action.

For reference, this was the commit that disabled ESLint - ac1bbad.

Copy link
Member Author

Choose a reason for hiding this comment

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

What George said. Thanks for verifying it, folks 🙌


// Defer the initial rendering to avoid the jumps due to the animation.
useEffect( () => {
Expand Down