From 4b9cb3c640a260a6f52337fe4e9b5f0133137331 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 11 Jul 2024 17:26:56 +0400 Subject: [PATCH 1/2] Core Data: Mark 'canUser' related actions resolvers as resolved --- packages/core-data/src/resolvers.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index d3ca23221eadd0..8f342a6090a031 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, + ] ); + } } } ); }; From 54a28767ce2120ceea653937f8679721615ec57f Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 11 Jul 2024 17:54:34 +0400 Subject: [PATCH 2/2] Fix unit tests --- packages/core-data/src/test/resolvers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core-data/src/test/resolvers.js b/packages/core-data/src/test/resolvers.js index 95a70b5e5c45f9..f9cf7051601f37 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();