fix(mapping): stop discarding stale auto-load responses, always clear loading state, keep column-role menu open - #179
Open
benoitcayladbx wants to merge 1 commit into
Conversation
… loading state, keep column-role menu open Three related fixes in the entity/relationship mapping panels: The saved SQL query auto-loads in the background when a panel opens. Its response is now matched against the generation captured when it was scheduled (not re-read at response time), so it is no longer silently discarded if the panel finished mounting before the response arrived. Both the entity and relationship panels also stop discarding a response just because the user switched panel/generation in the meantime — the Refresh button and loading spinner are now always cleared in the completion path regardless, so a slow query can no longer leave the button stuck on "Refreshing..." or the spinner stuck visible. If the previously saved ID column is no longer present in a refreshed result set, the first available column is now auto-selected instead of being left unset. The per-column role menu (assign ID / Label / an attribute to a result column) now stays open across clicks and reopens on the same column after each assignment, instead of closing after every single click — multiple roles can be assigned to different columns in one pass. The existing "Clear" menu item (already present in the markup) now actually clears a column's roles, which it previously did not do at all: the click handler had no branch for it, so clicking it silently did nothing. Rebuilt from scratch against the current develop, which has meanwhile gained a schema-drift feature (auto-load, badges, panel close) in this same area — this PR only touches the pre-existing race-condition and menu-interaction issues above, none of it overlaps with schema-drift. A companion, unrelated bug — a literal DOM id shared between the entity and relationship panels' save buttons — no longer applies: develop's redesign replaced the old manual Apply/Save button with auto-save on panel dismiss, and removed that button from the markup entirely.
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.
Reopened against
0.9.0afterdevelopwas deleted. GitHub cannot reopen #153 (closed PR + missing base), so this is a successor of #153 with the same commits. Original author: @jeremiaspf. Please rebase onto current0.9.0before review — expect conflicts.What
Three related fixes in the entity/relationship mapping panels (
mapping-design.js), rebuilt from scratch against the currentdevelop:Auto-load race condition. The saved SQL query auto-loads in the background when a panel opens. Its response is now matched against the generation captured when the auto-load was scheduled, not re-read at response time — so it's no longer silently discarded if the panel finishes mounting before the response arrives. Both the entity and relationship panels also stop discarding a response just because the user switched panel/generation in the meantime; the Refresh button and loading spinner are now unconditionally cleared in the completion path, so a slow query can no longer leave the button stuck on "Refreshing..." or the spinner stuck visible. If a previously saved ID column is no longer present in a refreshed result set, the first available column is now auto-selected instead of left unset.
Column-role menu. The per-column menu (assign ID / Label / an attribute to a result column) now stays open across clicks and reopens on the same column after each assignment, instead of closing after every single click — so multiple roles can be assigned across columns in one pass without reopening the menu each time. The existing "Clear" menu item (already present in the markup, added along with the rest of this menu's current design) now actually clears a column's roles — previously the click handler had no branch for
data-action="clear"at all, so clicking it silently did nothing.Why
All three are UX papercuts that make the mapping panels tedious or misleading to use in practice: a stuck "Refreshing..." button after switching panels, a saved ID column silently reset to nothing after a schema change, and a "Clear" button that visibly exists but doesn't work.
Note on scope — rebuilt against current develop
This PR replaces a fix we originally wrote against 0.7.1 and held back, because
develophad since reworked this same file substantially (a schema-drift feature: auto-load of live-schema warnings, drift badges,guardedCloseMappingPanel). We rebuilt the fix from scratch directly against the current file rather than porting the old patch, dropping one piece of it that no longer applies: our original fix also renamed a literal DOM id (savePanelBtn→manualSavePanelBtn) shared between the entity and relationship panels' save buttons. That whole button is gone ondevelop— replaced by auto-save on panel dismiss — so there's nothing left to rename; the two leftovergetElementById('savePanelBtn')calls inupdateEntityPanelSaveBtn/updateRelPanelSaveBtnare harmless dead code (alwaysnull, guarded byif (saveBtn)) and we left them alone rather than touching code unrelated to what this PR fixes.How to test