-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Page List: Fix ESLint warnings #52267
Conversation
Size Change: -5 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
Flaky tests detected in fb4aa50. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5450859521
|
const getBlockList = ( parentId = parentPageID ) => { | ||
const childPages = pagesByParentId.get( parentId ); | ||
const pagesTree = useMemo( | ||
function makePagesTree( parentId = 0, level = 0 ) { |
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.
That's not from this PR, but it's a bit weird to see the function declaration inside useMemo
. Can't we declare the function outside the components?
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.
As long as it's valid JS, I don't see a problem :)
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.
Lets fix this in a followup.
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.
LGTM
What?
PR fixes the ESLint warning inside the Page List block's edit component.
How?
I moved the function definition inside the
useMemo
hook.Testing Instructions
Confirm page list is rendered as before.