fix(sql-lab): normalize tabViewId in QUERY_EDITOR_SET_SQL reducer#40983
Open
yousoph wants to merge 1 commit into
Open
fix(sql-lab): normalize tabViewId in QUERY_EDITOR_SET_SQL reducer#40983yousoph wants to merge 1 commit into
yousoph wants to merge 1 commit into
Conversation
When SqllabBackendPersistence is enabled, queries store sqlEditorId as the backend tabViewId rather than the client-side id. The restoreSql handler in QueryTable dispatches queryEditorSetSql with that tabViewId, but the reducer's alterUnsavedQueryEditorState was routing it to the queryEditors array path using the tabViewId as a lookup key — which never matched because editors are indexed by client-side id. Result: no state change, editor never updated. Fix mirrors the existing START_QUERY normalization pattern: look up the editor by tabViewId field first, fall back to using the id as-is. Fixes sc-108187 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Bito Review Skipped - Source Branch Not Found |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40983 +/- ##
==========================================
- Coverage 64.30% 64.30% -0.01%
==========================================
Files 2657 2657
Lines 144060 144063 +3
Branches 33216 33218 +2
==========================================
- Hits 92641 92638 -3
- Misses 49797 49803 +6
Partials 1622 1622
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
restoreSqlpassesquery.sqlEditorId(=tabViewId) as the editor ID, but the reducer'salterUnsavedQueryEditorStateroutes it toalterInArrlooking for an editor withid === tabViewId— no match because editors are indexed by client-side IDtabViewId → client-side idnormalization thatSTART_QUERYalready usesTest plan
QUERY_EDITOR_SET_SQLwithtabViewIdcorrectly updatesunsavedQueryEditor.sql🤖 Generated with Claude Code