Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/containers/Tenant/Tenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ export function Tenant(props: TenantProps) {
getTenantSummaryState,
);

// TODO: name is used together with database to keep old links valid, do not remove
const {database: queryDatabase, schema, name, handleDatabaseChange} = useTenantQueryParams();

React.useEffect(() => {
if (name && !queryDatabase) {
handleDatabaseChange(name);
}
}, [queryDatabase, name, handleDatabaseChange]);

const database = queryDatabase ?? name;
const {database, schema} = useTenantQueryParams();

if (!database) {
throw new Error('Tenant name is not defined');
Expand Down
9 changes: 7 additions & 2 deletions src/containers/Tenant/useTenantQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ export function useTenantQueryParams() {
[setQueryParams],
);

React.useEffect(() => {
if (name && !database) {
setQueryParams({database: name, name: undefined}, 'replaceIn');
}
}, [database, name, setQueryParams]);

return {
showHealthcheck,
handleShowHealthcheckChange,
database,
database: database || name,
handleDatabaseChange,
showGrantAccess,
handleShowGrantAccessChange,
Expand All @@ -76,6 +82,5 @@ export function useTenantQueryParams() {
handleIssuesFilterChange,
aclSubject,
handleAclSubjectChange,
name,
};
}
Loading