You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "justinpark (via GitHub)" <gi...@apache.org> on 2025/08/21 00:03:28 UTC
[PR] fix(sqllab): autocomplete and delete tabs [superset]
justinpark opened a new pull request, #34781:
URL: https://github.com/apache/superset/pull/34781
### SUMMARY
In the previous #33522, the autocomplete function was set to be skipped before it was synced. In this commit, following the fix for the SQL editor flushing issue in #34720, this behavior has been reverted so that the autocomplete function works correctly. Additionally, an issue where deleted tabs were not removed upon refresh before they were synced to the server has been fixed.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
- autocomplete
before:
https://github.com/user-attachments/assets/d45df600-6507-46a1-a201-04873e47a204
after:
https://github.com/user-attachments/assets/e9ad5f39-4bf7-43db-93a5-2d478f42c712|
- close tabs
before:
https://github.com/user-attachments/assets/13f189ef-2886-47c1-8383-eb4a385d0762
after:
https://github.com/user-attachments/assets/cf2d5a32-399b-441e-a27c-09fbe6891396
### TESTING INSTRUCTIONS
Open a new tab and type some keyword to check autocomplete and then close the tab and then refresh the page for deletion
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): autocomplete and delete tabs [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #34781:
URL: https://github.com/apache/superset/pull/34781#discussion_r2289562085
##########
superset-frontend/src/SqlLab/reducers/getInitialState.ts:
##########
@@ -221,18 +224,21 @@ export default function getInitialState({
});
}
if (sqlLab.tabHistory) {
- tabHistory.push(...sqlLab.tabHistory);
+ tabHistory.push(
+ ...sqlLab.tabHistory.filter(
+ tabId => !sqlLab.destroyedQueryEditors?.[tabId],
+ ),
+ );
}
- lastUpdatedActiveTab = tabHistory.slice(tabHistory.length - 1)[0] || '';
-
if (sqlLab.destroyedQueryEditors) {
Object.entries(sqlLab.destroyedQueryEditors).forEach(([id, ts]) => {
+ destroyedQueryEditors[id] = ts;
if (queryEditors[id]) {
- destroyedQueryEditors[id] = ts;
delete queryEditors[id];
}
});
}
+ lastUpdatedActiveTab = tabHistory.slice(tabHistory.length - 1)[0] || '';
Review Comment:
### Unsafe Active Tab Assignment <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The lastUpdatedActiveTab is assigned without checking if the last tab in history is valid (not destroyed and exists in queryEditors).
###### Why this matters
This could lead to an invalid active tab being set, causing the UI to attempt to display a non-existent or destroyed tab.
###### Suggested change ∙ *Feature Preview*
Add validation to ensure the last tab is valid:
```typescript
const lastTab = tabHistory.slice(tabHistory.length - 1)[0];
lastUpdatedActiveTab = lastTab && queryEditors[lastTab] ? lastTab : '';
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/03d898c6-ab80-498d-be47-59ad478b62c3/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/03d898c6-ab80-498d-be47-59ad478b62c3?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/03d898c6-ab80-498d-be47-59ad478b62c3?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/03d898c6-ab80-498d-be47-59ad478b62c3?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/03d898c6-ab80-498d-be47-59ad478b62c3)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:7df86b07-5168-49dd-ad6d-8f4fcb132ae5 -->
[](7df86b07-5168-49dd-ad6d-8f4fcb132ae5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): autocomplete and delete tabs [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on PR #34781:
URL: https://github.com/apache/superset/pull/34781#issuecomment-3208518889
cc: @rebenitez1802
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): autocomplete and delete tabs [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark merged PR #34781:
URL: https://github.com/apache/superset/pull/34781
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org