Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add caching to the useEntityPermission hook (#9064)
* Add caching to the useEntityPermission hook Signed-off-by: Joon Park <joonp@spotify.com> * Remove useRef Signed-off-by: Joon Park <joonp@spotify.com> * Use useSWR hook Signed-off-by: Joon Park <joonp@spotify.com>
- Loading branch information
1 parent
74298c1
commit 6acc8f7
Showing
5 changed files
with
60 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@backstage/plugin-catalog-react': patch | ||
--- | ||
|
||
Add caching to the useEntityPermission hook | ||
|
||
The hook now caches the authorization decision based on the permission + the entity, and returns the cache match value as the default `allowed` value while loading. This helps avoid flicker in UI elements that would be conditionally rendered based on the `allowed` result of this hook. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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