Skip to content

fix: Top Level API dialog bugs (#6103, #6104, #6105, #6106)#6109

Open
Pyatakov wants to merge 4 commits into
developfrom
fix/api-docs-dialog
Open

fix: Top Level API dialog bugs (#6103, #6104, #6105, #6106)#6109
Pyatakov wants to merge 4 commits into
developfrom
fix/api-docs-dialog

Conversation

@Pyatakov
Copy link
Copy Markdown
Contributor

@Pyatakov Pyatakov commented May 21, 2026

Description

  • Top Level API: Dialog shows false "Selected block does not support API aliases" on valid blocks #6103 — false "Selected block does not support API aliases" errors. loadTagsData ran in parallel with the forkJoin that calls registeredService.registerConfig(...) and cleared the loader after the tag request returned. When tags were faster than getBlockInformation, the toolbar (including the API button) became interactive before block metadata was registered, and every row failed the API-support check. Refactored loadTagsData to return an Observable and folded it into the policy-update forkJoin so the loader stays up until registerConfig + finishedLoad have run. While there, hoisted the per-block tag dedup out of the loop (O(N*M) spread/Set rebuilds → one pass). For users without POLICIES_POLICY_UPDATE, the tag observable still drives the spinner.
  • Top Level API: Importing a malformed JSON file silently does nothing #6104 — silent malformed imports. onImport caught all parse errors with an empty catch and ignored non-array payloads with no else. Routed parse failures, non-array shapes, and FileReader errors through InformService.errorShortMessage so the user sees a toast.
  • Top Level API: Alias edit field intermittently strips / characters #6105 — alias / 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.
  • Top Level API: No "unsaved changes" warning when leaving the policy editor #6106 — no warning when leaving with unsaved changes. backToPolicies() navigated unconditionally, so users who edited the API documentation (or anything else cached in PolicyStorage) had no signal that the toolbar Save was a separate step. Mirrored the tryPublishPolicy pattern: check storage for dirty state, prompt with Cancel / Leave for now / Save. Save runs asyncUpdatePolicy then navigates; Leave for now navigates and leaves the local edit in IndexedDB so the existing checkState() flow can offer to restore it on the next open.

@Pyatakov Pyatakov requested review from a team as code owners May 21, 2026 13:33
@Pyatakov Pyatakov self-assigned this May 21, 2026
@Pyatakov Pyatakov force-pushed the fix/api-docs-dialog branch from 7ba4e00 to 43b4f2d Compare May 21, 2026 13:35
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Test Results

 32 files  ±0   64 suites  ±0   1s ⏱️ ±0s
 35 tests ±0    4 ✅ ±0  0 💤 ±0  31 ❌ ±0 
165 runs  ±0  134 ✅ ±0  0 💤 ±0  31 ❌ ±0 

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.

@Pyatakov Pyatakov force-pushed the fix/api-docs-dialog branch 4 times, most recently from d29d8e3 to 3143632 Compare May 21, 2026 14:06
@Pyatakov Pyatakov changed the title fix: Top Level API dialog bugs (#6103, #6104, #6106) fix: Top Level API dialog bugs (#6103, #6104, #6105, #6106) May 21, 2026
@Pyatakov Pyatakov requested review from a team as code owners May 22, 2026 14:44
@Pyatakov Pyatakov force-pushed the fix/api-docs-dialog branch from c8b69c7 to 18d472f Compare May 22, 2026 14:59
Pyatakov added 4 commits May 26, 2026 17:35
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>
@Pyatakov Pyatakov force-pushed the fix/api-docs-dialog branch from 18d472f to e794225 Compare May 26, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant