feat(core): add use guard hook
Previously, we used useLiveData(guardService.can$()) to get the guard result, but guardService.can$() will request the server to revalidate the permission when calling it, will cause additional network requests when re-render.
This pr make a new hook useGuard to fix this problem.
And the side effect in can$ is moved to revalidateCan() to make that the subscribe method is pure
-
#11180
👈 (View in Graphite)
-
#11177
: 1 other dependent PR (#11179
) -
canary
How to use the Graphite Merge Queue
Add either label to this PR to merge it via the merge queue:
- merge - adds this PR to the back of the merge queue
- hotfix - for urgent hot fixes, skip the queue and merge this PR next
You must have a Graphite account in order to use the merge queue. Sign up using this link.
An organization admin has enabled the Graphite Merge Queue in this repository.
Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.
This stack of pull requests is managed by Graphite. Learn more about stacking.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 54.36%. Comparing base (
a10acf3) to head (3df51a2). Report is 1 commits behind head on canary.
Additional details and impacted files
@@ Coverage Diff @@
## canary #11180 +/- ##
=======================================
Coverage 54.36% 54.36%
=======================================
Files 2547 2547
Lines 115108 115108
Branches 18716 18717 +1
=======================================
+ Hits 62578 62581 +3
+ Misses 51200 51198 -2
+ Partials 1330 1329 -1
| Flag | Coverage Δ | |
|---|---|---|
| server-test | 78.90% <ø> (+<0.01%) |
:arrow_up: |
| unittest | 30.28% <ø> (-0.01%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Merge activity
- Mar 25, 9:21 AM EDT: A user added this pull request to the Graphite merge queue.
- Mar 25, 10:35 AM EDT: A user merged this pull request with the Graphite merge queue.