-
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
Refactor inserter tabs #61048
Refactor inserter tabs #61048
Conversation
Size Change: +16 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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. |
96fb85a
to
02b0efb
Compare
bf8f690
to
9a1ec9c
Compare
forwardRef, | ||
useState, | ||
useCallback, | ||
useMemo, |
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 wonder if its ok to remove all the useMemos
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'm not sure -- let's performance test it and see if it's the same or better without it, and then we can add it back in if we need to. Before it was especially necessary because everything was running everything on mount. Now it doesn't build all at once but each tab content gets rendered when it's clicked.
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 tried a memoized and unmemoized version of the blocks tab, and memoizing was faster by our specs:
memo:
│ inserterOpen │ '15.22 ms' │
│ inserterSearch │ '4.79 ms' │
│ inserterHover │ '1.83 ms' │
no memo
│ inserterOpen │ '15.76 ms' │
│ inserterSearch │ '5.56 ms' │
│ inserterHover │ '1.89 ms' │
02b0efb
to
9a054a3
Compare
<Button | ||
className="block-editor-sidebar__close-button" | ||
icon={ closeSmall } | ||
label={ __( 'Close block inserter' ) } | ||
onClick={ () => setIsInserterOpened( false ) } | ||
size="compact" | ||
/> |
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.
It feels weird to put this button inside of the InserterTabs component. I think we should move it up into the menu.js or leave it as it was. The button was working, it just needed a boosted z-index to be clickable.
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 did this so it matches with the ListView
Closed in favor of #61108 |
What?
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast