Repository navigation
fix(web): keep rule dialog permissions settled while scope resolves - #719
Merged
Merged
Conversation
Changing the scope in the rule dialog re-rendered the permission fields for the new scope immediately, while its inherited values were still being resolved. Every field briefly showed "Inherit (unknown)" before the resolution landed. The dialog now renders permission fields from the last settled target: the scope together with its resolved inherited values (or resolution error). The fields keep the previous target until the replacement resolves, then switch in a single render. Explicit values outside the new scope are pruned at that same moment. The resolution hook now keys its result on the target independently of `enabled`, which replaces the separate last-request bookkeeping that kept a closing dialog from dropping its result.
The settled permission fields stay visible while a new scope resolves, but choices made against them would be judged by inherited values of a target that is no longer selected, and choices for permissions the new scope lacks would be silently pruned. The permission fieldset is now marked busy and its radios disabled until the resolution settles. Saving is a no-op in that window; the save button itself stays enabled so it does not flicker on every scope change.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Switching the scope in the new/edit rule dialog rendered the new scope's permission fields before their inherited values were resolved, so every field briefly flashed Inherit (unknown).
Fix
aria-busyand its radios are disabled, so no choice is made against a stale target. Saving is a no-op in that window; the save button stays enabled so it does not flicker on each scope change.useAccessResolutionkeys its result on the target independently ofenabled, replacing the separate last-request state that kept a closing dialog from dropping its result.Tests
record-dialog_test.tsx: observes every DOM mutation across two scope switches with the resolution held back, asserting no unknown-inheritance state ever renders and only the old or final field sets appear (fails onmain); while pending, fields are busy and disabled and clicking save sends no write.resolution_test.tsx: disabling keeps the result for an unchanged target and drops it when the target changes.Verification
pnpm exec vitest runoverrecord-dialog_test.tsx,resolution_test.tsx,permission-fields_test.tsxanddashboard-admin-permissions_test.tsx— 59 passedpnpm --filter @floway-dev/web run typecheckpnpm exec eslintover the changed sources and tests