-
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
Make Navigation fallback selector private #51413
Conversation
@draganescu I started on this but I'm not sure how to get the |
Yes it looks like the private selectors are private in the sense they're not exported, not in the sense we use the locking API. Is it difficult to implement lock/unloc in this PR as well? Can I help? |
Yeh I guess I'm not sure how to go about implementing the lock/unlock stuff for Core Data. Other modules have it. Any help much appreciated. |
b0c9c8a
to
ddaa659
Compare
Size Change: -15.5 kB (-1%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
ddaa659
to
ace42c3
Compare
The problem here is that it looks like locked selectors do not call their resolvers. |
Ah that's not great. Do you have a code path for that problem? |
bf6c954
to
00844b5
Compare
Hey peeps, does this need to go into WP 6.3? |
resolvers, | ||
store, | ||
resolversCache | ||
); |
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.
great fix, and thanks for following up on this @draganescu
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.
Yes, this is probably the first time we're creating a private selector with a resolver 👍 However, this fix won't work when you register a private selector after a store got instantiated:
const store = createReduxStore( name, { ..., resolvers: { foo } );
register( store ); // instance is created and resolvers bound
unlock( store ).registerPrivateSelectors( { foo } );
Here you supplied a resolver for foo
, registered a private selector foo
, but they won't be bound together. You'd have to move the register
call after the private registration.
That's why the private selectors are bound lazily. I'll try to do a more perfect fix in a separate PR.
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 specifically moved the registration after to get this effect 🤷🏻
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.
Yes, you had to move the registration, but you shouldn't have to, that's the bug 🙂
I think this PR is mergeable with the simple resolver fix. The correct solution turns out the be a rather big PR -- although it doesn't change a lot of code, it involves a lot of refactoring.
Testing now |
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 found (and fixed) a bug with one usage in the Browse Mode sidebar that wasn't unlocked. Other than that this tests well.
@tellthemachines This needs to land in 6.3 🙏
@scruffian I cannot approve this cos I raised the PR so can you ✅ ?
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 breaks the navigation section of Site View, if you have no navigation menus.
Flaky tests detected in 06ad9ce. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5400496691
|
It seems the update in the The
|
I think it's because for private selectors, We could merge #52036 to unblock this. I'm not happy with the PR, but it works. |
I can try to do a minimalistic solution right here in this PR. #52036 is bigger than I originally expected especially because I wanted to add a good unit test, and that requires a working |
Pushed a fix for the private selectors with resolvers. I also had to remove |
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 is now working well for me.
* Move selector to become private * adds basic lock functionality * remove useless lock-unlock file * map private selectors to resolvers * Unlock the other usage * only create one fallback per session * Fix core-data duplicate private opt-in * Data: bind resolvers to selectors individually, support private selectors --------- Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Jarda Snajdr <[email protected]>
I just cherry-picked this PR to the update/wp6-3-beta3 branch to get it included in the next release: 7b8db97 |
* Footnotes: inscrease selector specificity for anchor (#52179) * Patterns: Include template parts for custom areas in Uncategorized category (#52159) * Fix custom patterns console error (#51947) * Fix error with react list key with new custom patterns list in inserter * Update placeholder key * Add comment to explain the different keys * Patterns: Fix missing custom patterns in patterns explorer (#51889) * Add custom patterns to pattern explorer * show custom patterns in the patterns explorer dialog * remove changes from 51877 * Fix up use of async lists * remove a bit of code duplication by adding a new hook * add 51877 fix back to make testing easier * Just assign the key value in one place * Refactor the custom patterns to use the usePatternsState hook * Fix use of async list * Translate strings and remove unneeded fields from pattern object * Try integrating unsynced patterns directly into pattern selectors (#51955) * Include reusable blocks with an undefined sync status in inserter items * Update docs * Remove change to hover dependencies --------- Co-authored-by: Daniel Richards <[email protected]> * i18n: Add context to the word "Filters" (#52198) * Update home template icon (#52075) * Centralise all permissions lookup in Link UI and enable (#52166) * BlockRemovalWarningModal: Fix incorrect '_n' usage (#52164) * Fix fetching Nav fallback ID flushing Navigation entity cache (#52069) * Only flush the `getEntityRecords` cache if the fallback isn’t already in state * Save the edited entity record to a const and then invert it to determine whether we should invalidate the recordds --------- Co-authored-by: scruffian <[email protected]> * Block Editor: Unify texts for Create pattern modal (#52151) * Fix history back after entering edit mode from Patterns (#52112) * Add template part icons to the library grid items (#51963) * Patterns: Fix sidebar tab label (#51953) * Patterns: Fix setting of sync status for fully synced patterns (#51952) * Library: Reinstate manage all template parts page (#51961) * Command Palette: fix incorrect path and snackbar message when template part is deleted (#52034) * Command Center: Fix incorrect navigation when deleting template part * removeTemplate: consider title type * Drop-indicator: remove white border. (#52122) * Make Navigation fallback selector private (#51413) * Move selector to become private * adds basic lock functionality * remove useless lock-unlock file * map private selectors to resolvers * Unlock the other usage * only create one fallback per session * Fix core-data duplicate private opt-in * Data: bind resolvers to selectors individually, support private selectors --------- Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Jarda Snajdr <[email protected]> * Focus Mode: Use the symbol icon if a pattern is being edited (#52031) * Footnotes: register meta field for pages (#52024) * Fix unintentional toggling on of distraction free (#52090) * replace toggle with set preference - because I don't read code properly it seems * remove notification * Revert "Updating social link attributes (#51997)" (#52019) This reverts commit c711e2a. * Update home template name (#52048) * Removes unused call (#51988) * Remove ability for user to toggle sync status after pattern creation (#51998) * Fix disable DFM when opening styles command (#52165) * Update custom patterns label to 'My patterns' (#51949) * rename custom patterns to my patterns * Add my patterns label to inserter and show at the top --------- Co-authored-by: Daniel Richards <[email protected]> * Library: Add sync status to pattern details screen (#51954) * Patterns: Rename Library to Patterns (#52102) * [Library] Add lock icon for theme patterns (#51990) * Add lock icon for theme patterns * Change to class names * Add aria-description * Change wording * Patterns: Use "detached" copy consistently (#51993) * Editor initrial appender: Zero out margins in constrained layouts. (#52026) * Update pattern creation modal in library (#51946) * Fix missing snackbars in Library (#52021) * Make the entire preview clickable in order to enter "edit" mode in focus mode (#51973) * Page Content Focus: Add welcome guides (#52014) * Page Content Focus: Add welcome guides * Don't show when editor guide is active * Just use regular accent/theme color in all guides * slight copy change page guide * Update components changelog * Disable new guides in E2E tests * Use s.w.org videos --------- Co-authored-by: Saxon Fletcher <[email protected]> --------- Co-authored-by: Ella <[email protected]> Co-authored-by: Aaron Robertshaw <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: Daniel Richards <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Dave Smith <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Carolina Nymark <[email protected]> Co-authored-by: Joen A <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Jarda Snajdr <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Ramon <[email protected]> Co-authored-by: Nik Tsekouras <[email protected]> Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Rich Tabor <[email protected]> Co-authored-by: Robert Anderson <[email protected]>
* Move selector to become private * adds basic lock functionality * remove useless lock-unlock file * map private selectors to resolvers * Unlock the other usage * only create one fallback per session * Fix core-data duplicate private opt-in * Data: bind resolvers to selectors individually, support private selectors --------- Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Jarda Snajdr <[email protected]>
What?
Makes the selector added for Navigation fallbacks private.
Closes #50372
Why?
Because we're not 100% confident on the API yet.
How?
core-data
packagedata
package to map private selectors to their resolversTesting Instructions
getNavigationFallbackId
should not accessible without unlocking the core store