albraa911sa-lgtm commented on code in PR #41052:
URL: https://github.com/apache/superset/pull/41052#discussion_r3413970080
##########
superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx:
##########
@@ -107,14 +117,23 @@ const SqlEditorTabHeader: FC<Props> = ({ queryEditor })
=> {
[dispatch],
);
- function renameTab() {
- // TODO: Replace native prompt with a proper modal dialog
- // eslint-disable-next-line no-alert
- const newTitle = prompt(t('Enter a new title for the tab'));
- if (newTitle) {
- actions.queryEditorSetTitle(qe, newTitle, qe.id);
+ function openRenameModal() {
+ setNewTitle(qe.name);
+ setIsRenameModalOpen(true);
+ }
+
+ function handleRenameConfirm() {
+ const trimmed = newTitle.trim();
+ if (trimmed) {
+ actions.queryEditorSetTitle(qe, trimmed, qe.id);
}
+ setIsRenameModalOpen(false);
+ }
Review Comment:
Fixed: added an early return when `trimmed` is empty, so pressing Enter with
whitespace-only input now keeps the modal open instead of closing it. Keyboard
and Save-button behavior are now consistent.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]