Fix: pattern selection missing after making duplicate selection - #434
Merged
Conversation
Signed-off-by: brookewp <brooke.kaminski@automattic.com>
Contributor
|
Test this PR in WordPress Playground. |
Member
This is correct, and my fault because I don't think I read the docs closely:
I will do a review to find other spots where I made this mistake. Note I pushed up a type improvement in ad920af. |
chriszarate
approved these changes
Mar 26, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@alecgeatches found an issue after selecting the same item in succession. When doing so, no patterns are available to select in the modal:
missingpatterns.mov
This appears to be due to a brief moment where
__experimentalGetAllowedPatternsreturns an empty array, and its state isn't updated. I believe this happened because__experimentalGetAllowedPatternswas extracted fromuseSelectas a function reference rather than tracking its return value.Solution
In this PR,
__experimentalGetAllowedPatterns(rootClientId)is now inside the selector function, to ensure its result is included inuseSelect's state tracking.restoredpatterns.mov
Testing
After selecting an item in a block (replicated in the art institute and airtable blocks), add another block and make the same selection. You should see patterns to select (ensure custom patterns are present in addition to default).