Skip to content

Commit 991f156

Browse files
committed
fix(Tenant): switch to query tab for inserted query
1 parent 09adfa5 commit 991f156

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/containers/Tenant/utils/schemaActions.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,39 @@ export const getActions = (
4444
ignoreQueryPrefix: true,
4545
});
4646

47+
const switchTabToQuery = () => {
48+
history.push(
49+
createHref(routes.tenant, undefined, {
50+
...queryParams,
51+
[TenantTabsGroups.general]: TenantGeneralTabsIds.query,
52+
}),
53+
);
54+
};
55+
4756
const onCreateTableClick = () => {
4857
dispatch(changeUserInput({input: createTableTemplate(path)}));
58+
switchTabToQuery();
59+
// here and in the other handlers this should be called after switching tab:
60+
// redux-location-state catches the history.push event from the tab switching
61+
// before active path updates in url, preventing its update at all
4962
setActivePath(path);
5063
};
5164

5265
const onAlterTableClick = () => {
5366
dispatch(changeUserInput({input: alterTableTemplate(path)}));
67+
switchTabToQuery();
5468
setActivePath(path);
5569
};
5670

5771
const onSelectQueryClick = () => {
5872
dispatch(changeUserInput({input: selectQueryTemplate(path)}));
73+
switchTabToQuery();
5974
setActivePath(path);
6075
};
6176

6277
const onUpsertQueryClick = () => {
6378
dispatch(changeUserInput({input: upsertQueryTemplate(path)}));
79+
switchTabToQuery();
6480
setActivePath(path);
6581
};
6682

@@ -85,12 +101,7 @@ export const getActions = (
85101

86102
const onOpenPreviewClick = () => {
87103
dispatch(setShowPreview(true));
88-
history.push(
89-
createHref(routes.tenant, undefined, {
90-
...queryParams,
91-
[TenantTabsGroups.general]: TenantGeneralTabsIds.query,
92-
}),
93-
);
104+
switchTabToQuery();
94105
setActivePath(path);
95106
};
96107

0 commit comments

Comments
 (0)