fix: Top Level API dialog bugs (#6103, #6104, #6105, #6106)#6109
Open
Pyatakov wants to merge 4 commits into
Open
fix: Top Level API dialog bugs (#6103, #6104, #6105, #6106)#6109Pyatakov wants to merge 4 commits into
Pyatakov wants to merge 4 commits into
Conversation
7ba4e00 to
43b4f2d
Compare
Test Results 32 files ±0 64 suites ±0 1s ⏱️ ±0s For more details on these failures, see this check. Results for commit e794225. ± Comparison against base commit 0d35da3. ♻️ This comment has been updated with latest results. |
d29d8e3 to
3143632
Compare
c8b69c7 to
18d472f
Compare
loadTagsData ran in parallel with the forkJoin that registers block metadata and cleared `loading` on its own ~500ms timer. When tags beat getBlockInformation, the API toolbar button became interactive before metadata was registered, and the dialog flagged every row as "Selected block does not support API aliases". Refactor loadTagsData to return an Observable and fold it into the forkJoin so the loader only clears once registerConfig has run. While here, hoist the per-block tag dedup out of the loop (O(N*M) spread/Set rebuilds → one pass). Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
onImport caught parse errors with an empty catch and silently ignored non-array payloads, so a bad import looked like the dialog had eaten the user's selection. Route parse failures, non-array shapes, and FileReader errors through InformService.errorShortMessage so the user sees a toast. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
backToPolicies navigated unconditionally, so users who edited API documentation (cached only in PolicyStorage until the toolbar Save) lost any signal that their changes weren't yet persisted. Mirror the tryPublishPolicy pattern: check storage for dirty state, prompt with Cancel / Leave for now / Save. Save runs asyncUpdatePolicy before navigating; Leave for now navigates and leaves the edit in IndexedDB so checkState() can restore it on the next open. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
(input) raced with NgModel's own listener and could let a raw keystroke overwrite the sanitized value. (ngModelChange) runs after NgModel commits, so the sanitizer always wins. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
18d472f to
e794225
Compare
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.
Description
loadTagsDataran in parallel with theforkJointhat callsregisteredService.registerConfig(...)and cleared the loader after the tag request returned. When tags were faster thangetBlockInformation, the toolbar (including the API button) became interactive before block metadata was registered, and every row failed the API-support check. RefactoredloadTagsDatato return an Observable and folded it into the policy-updateforkJoinso the loader stays up untilregisterConfig+finishedLoadhave run. While there, hoisted the per-block tag dedup out of the loop (O(N*M)spread/Set rebuilds → one pass). For users withoutPOLICIES_POLICY_UPDATE, the tag observable still drives the spinner.onImportcaught all parse errors with an emptycatchand ignored non-array payloads with noelse. Routed parse failures, non-array shapes, andFileReadererrors throughInformService.errorShortMessageso the user sees a toast./characters intermittently disappearing. The field used(input)alongside[(ngModel)], so the DOM input event raced with NgModel's own input listener. When NgModel committed the raw keystroke after the sanitizer wrote the cleaned value, the raw value won. Switched to(ngModelChange), which fires after NgModel commits the model write, so the sanitizer always runs against (and overwrites) the committed value.backToPolicies()navigated unconditionally, so users who edited the API documentation (or anything else cached inPolicyStorage) had no signal that the toolbarSavewas a separate step. Mirrored thetryPublishPolicypattern: check storage for dirty state, prompt withCancel/Leave for now/Save.SaverunsasyncUpdatePolicythen navigates;Leave for nownavigates and leaves the local edit in IndexedDB so the existingcheckState()flow can offer to restore it on the next open.