From 88865fce680f07a7d28ae083440b195dfeb1a7c7 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 11 Jul 2024 20:01:31 +0400 Subject: [PATCH] Core Data: Mark 'canUser' related actions resolvers as resolved (#63435) Co-authored-by: Mamaduka Co-authored-by: youknowriad --- packages/core-data/src/resolvers.js | 9 +++++++++ packages/core-data/src/test/resolvers.js | 1 + 2 files changed, 10 insertions(+) diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index d3ca23221eadd..8f342a6090a03 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -450,6 +450,15 @@ export const canUser = .join( '/' ); dispatch.receiveUserPermission( key, permissions[ action ] ); + + // Mark related action resolutions as finished. + if ( action !== requestedAction ) { + dispatch.finishResolution( 'canUser', [ + action, + resource, + id, + ] ); + } } } ); }; diff --git a/packages/core-data/src/test/resolvers.js b/packages/core-data/src/test/resolvers.js index 95a70b5e5c45f..f9cf7051601f3 100644 --- a/packages/core-data/src/test/resolvers.js +++ b/packages/core-data/src/test/resolvers.js @@ -308,6 +308,7 @@ describe( 'canUser', () => { }; dispatch = Object.assign( jest.fn(), { receiveUserPermission: jest.fn(), + finishResolution: jest.fn(), } ); dispatch.mockReturnValue( ENTITIES ); triggerFetch.mockReset();