-
Notifications
You must be signed in to change notification settings - Fork 4.6k
POC: Filter toolbar items by prop in contentOnly #71469
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
Open
jeryj
wants to merge
13
commits into
trunk
Choose a base branch
from
update/private-slot-filter-content-toolbar
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−51
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9d99bdd
Add filter prop to slot fills
jeryj eec43dc
Use filtering in block controls slots
jeryj c16e98b
Make filtering on slot fills private
jeryj be7e1b2
Simplify slot fill ts definition
jeryj ee6b550
Remove alignment control from write mode
jeryj e79ee55
Remove unneeded category=content from toolbaritem
jeryj 2c48aee
Filter block tools in fill wrapper
jeryj b15e32e
Revert changes to slot fill - remove slot fill filtering from slot co…
jeryj e28f37b
Simplify fill filtering
jeryj a85db5e
Revert block-controls/slot.js
jeryj 49024a8
Really revert slot.js
jeryj 4232366
Use React's Children.toArray
jeryj df2028f
Use fillProps for filtering contentOnly block tools
jeryj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Simplify fill filtering
- Loading branch information
commit e28f37bcb9cfaf2c59a3ca78ab7e3b7c8e1350d7
There are no files selected for viewing
81 changes: 0 additions & 81 deletions
81
packages/block-editor/src/components/block-controls/content-only-filter.js
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This
filterwill always create a newArray. For perf reasons I wonder if there's a way to avoid that 🤔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.
We can certainly look to memoize.
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 had the AI write a performance test case to compare:
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.
Instead of the
Array.isArraycheck it's better to useReact.Children.toArray, which is a targeted helper that convertschildrento a valid array.I wouldn't worry about copying children at all. Every React render creates a tremendous amount of arrays and objects and then dumps them after the render is finished.
Also, the fill is typically used as:
Where the
childrenis a new array on every render. It's quite rare thatchildrenwould stay constant between renders.