diff --git a/web/src/components/features/modal/NewDatasetModal.tsx b/web/src/components/features/modal/NewDatasetModal.tsx index fc60faadb..fc1e2f4e0 100644 --- a/web/src/components/features/modal/NewDatasetModal.tsx +++ b/web/src/components/features/modal/NewDatasetModal.tsx @@ -20,7 +20,6 @@ export const NewDatasetModal: React.FC<{ afterCreate?: () => void; datasourceId?: string; }> = React.memo(({ open, onClose, beforeCreate, afterCreate, datasourceId }) => { - const router = useRouter(); const onChangePage = useAppLayoutContextSelector((s) => s.onChangePage); const { mutateAsync: createDataset, isPending: creatingDataset } = useCreateDataset(); const [selectedDatasource, setSelectedDatasource] = React.useState( @@ -54,7 +53,7 @@ export const NewDatasetModal: React.FC<{ }); const onAddDataSourceClick = useMemoizedFn(() => { - router.push(createBusterRoute({ route: BusterRoutes.SETTINGS_DATASOURCES_ADD })); + onChangePage(createBusterRoute({ route: BusterRoutes.SETTINGS_DATASOURCES_ADD })); setTimeout(() => { onClose(); }, 450); diff --git a/web/src/context/Dashboards/DashboardIndividualProvider/useDashboardCreate.ts b/web/src/context/Dashboards/DashboardIndividualProvider/useDashboardCreate.ts index 704cbc970..0b6cb4415 100644 --- a/web/src/context/Dashboards/DashboardIndividualProvider/useDashboardCreate.ts +++ b/web/src/context/Dashboards/DashboardIndividualProvider/useDashboardCreate.ts @@ -1,13 +1,13 @@ import { queryKeys } from '@/api/query_keys'; import { useBusterNotifications } from '@/context/BusterNotifications'; -import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; +import { BusterRoutes } from '@/routes/busterRoutes'; import { useMemoizedFn } from 'ahooks'; -import { useRouter } from 'next/navigation'; import { useSocketQueryMutation } from '@/api/buster_socket_query'; import { useQueryClient } from '@tanstack/react-query'; +import { useAppLayoutContextSelector } from '@/context/BusterAppLayout'; export const useDashboardCreate = ({}: {}) => { - const router = useRouter(); + const onChangePage = useAppLayoutContextSelector((x) => x.onChangePage); const queryClient = useQueryClient(); const { mutateAsync: deleteDashboard, isPending: isDeletingDashboard } = useSocketQueryMutation({ emitEvent: '/dashboards/delete', @@ -44,12 +44,10 @@ export const useDashboardCreate = ({}: {}) => { const res = await createDashboard({ ...rest, name: rest.name || '' }); if (rerouteToDashboard) { - router.push( - createBusterRoute({ - route: BusterRoutes.APP_DASHBOARD_ID, - dashboardId: res.dashboard.id - }) - ); + onChangePage({ + route: BusterRoutes.APP_DASHBOARD_ID, + dashboardId: res.dashboard.id + }); } return res.dashboard; diff --git a/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx b/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx index 82a916f5d..580b9703f 100644 --- a/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx +++ b/web/src/layouts/ChatLayout/ChatLayoutContext/ChatLayoutContext.tsx @@ -59,8 +59,9 @@ export const useChatLayout = ({ if (route) { setRenderViewLayoutKey('both'); - onChangePage(route); startTransition(() => { + console.log('HERE! FIX THIS HERE!'); + onChangePage(route); animateOpenSplitter('both'); }); }