diff --git a/apps/web/src/api/buster_rest/dashboards/dashboardQueryHelpers.ts b/apps/web/src/api/buster_rest/dashboards/dashboardQueryHelpers.ts index 5fba8f5ab..216fc5837 100644 --- a/apps/web/src/api/buster_rest/dashboards/dashboardQueryHelpers.ts +++ b/apps/web/src/api/buster_rest/dashboards/dashboardQueryHelpers.ts @@ -58,11 +58,7 @@ export const useGetDashboardAndInitializeMetrics = (prefetchData = true) => { metricsQueryKeys.metricsGetMetric(metric.id, metric.version_number).queryKey ); const upgradedMetric = upgradeMetricToIMetric(metric, prevMetric); - console.log( - 'upgradedMetric', - upgradedMetric, - metricsQueryKeys.metricsGetMetric(metric.id, metric.version_number).queryKey - ); + queryClient.setQueryData( metricsQueryKeys.metricsGetMetric(metric.id, metric.version_number).queryKey, upgradedMetric diff --git a/apps/web/src/api/buster_rest/dashboards/queryRequests.ts b/apps/web/src/api/buster_rest/dashboards/queryRequests.ts index 95c7bc403..f18ff4a06 100644 --- a/apps/web/src/api/buster_rest/dashboards/queryRequests.ts +++ b/apps/web/src/api/buster_rest/dashboards/queryRequests.ts @@ -116,6 +116,12 @@ export const useSaveDashboard = (params?: { updateOnSave?: boolean }) => { ); setOriginalDashboard(data.dashboard); onSetLatestDashboardVersion(data.dashboard.id, last(data.versions)?.version_number || 1); + + if (variables.restore_to_version) { + queryClient.invalidateQueries({ + queryKey: dashboardQueryKeys.dashboardGetDashboard(data.dashboard.id, null).queryKey + }); + } } } }); @@ -363,12 +369,10 @@ export const useShareDashboard = () => { }); }); }, - onSuccess: (data) => { - // queryClient.setQueryData( - // dashboardQueryKeys.dashboardGetDashboard(data.dashboard.id, data.dashboard.version_number) - // .queryKey, - // data - // ); + onSuccess: (data, variables) => { + queryClient.invalidateQueries({ + queryKey: dashboardQueryKeys.dashboardGetDashboard(variables.id, null).queryKey + }); } }); }; diff --git a/apps/web/src/components/features/dropdowns/SaveToDashboardDropdown.tsx b/apps/web/src/components/features/dropdowns/SaveToDashboardDropdown.tsx index 9c2842e9c..ee7b83b0e 100644 --- a/apps/web/src/components/features/dropdowns/SaveToDashboardDropdown.tsx +++ b/apps/web/src/components/features/dropdowns/SaveToDashboardDropdown.tsx @@ -69,7 +69,7 @@ export const useSaveToDashboardDropdownContent = ({ > & { ModalComponent: React.ReactNode; } => { - const { data: dashboardsList } = useGetDashboardsList({}); + const { data: dashboardsList } = useGetDashboardsList({}, { staleTime: 60 * 1000 }); const onChangePage = useAppLayoutContextSelector((x) => x.onChangePage); const [openNewDashboardModal, setOpenNewDashboardModal] = useState(false); diff --git a/apps/web/src/components/features/dropdowns/useThreeDotFavoritesOptions.tsx b/apps/web/src/components/features/dropdowns/useThreeDotFavoritesOptions.tsx index 433fdffa6..d1e0cc89e 100644 --- a/apps/web/src/components/features/dropdowns/useThreeDotFavoritesOptions.tsx +++ b/apps/web/src/components/features/dropdowns/useThreeDotFavoritesOptions.tsx @@ -24,8 +24,14 @@ export const useThreeDotFavoritesOptions = ({ const { mutateAsync: removeUserFavorite } = useDeleteUserFavorite(); const { data: userFavorites } = useGetUserFavorites(); const { data: metricList } = useGetMetricsList({}, { enabled: false }); - const { data: dashboardList } = useGetDashboardsList({}, { enabled: false }); - const { data: collectionList } = useGetCollectionsList({}, { enabled: false }); + const { data: dashboardList } = useGetDashboardsList( + {}, + { enabled: false, staleTime: 60 * 1000 } + ); + const { data: collectionList } = useGetCollectionsList( + {}, + { enabled: false, staleTime: 60 * 1000 } + ); const nameSearchArray = useMemo(() => { if (assetType === 'metric' && metricList) { diff --git a/apps/web/src/config/env.mjs b/apps/web/src/config/env.mjs index 07a622ddf..e2eca5ff6 100644 --- a/apps/web/src/config/env.mjs +++ b/apps/web/src/config/env.mjs @@ -52,7 +52,8 @@ const clientEnvSchema = z.object({ // Development/Testing credentials NEXT_PUBLIC_USER: z.string().optional(), - NEXT_PUBLIC_USER_PASSWORD: z.string().optional() + NEXT_PUBLIC_USER_PASSWORD: z.string().optional(), + NEXT_ENABLE_TANSTACK_PANEL: z.string().optional() }); const serverEnvSchema = z.object({}); diff --git a/apps/web/src/context/BusterReactQuery/BusterReactQueryAndApi.tsx b/apps/web/src/context/BusterReactQuery/BusterReactQueryAndApi.tsx index 832570e89..1235080c1 100644 --- a/apps/web/src/context/BusterReactQuery/BusterReactQueryAndApi.tsx +++ b/apps/web/src/context/BusterReactQuery/BusterReactQueryAndApi.tsx @@ -15,6 +15,10 @@ import { getQueryClient } from './getQueryClient'; const ENABLE_TANSTACK_PANEL = process.env.NEXT_ENABLE_TANSTACK_PANEL === 'true' || process.env.NODE_ENV === 'development'; +console.log({ + ENABLE_TANSTACK_PANEL, + NEXT_ENABLE_TANSTACK_PANEL: process.env.NEXT_ENABLE_TANSTACK_PANEL +}); const ReactQueryDevtools = dynamic( () => @@ -65,6 +69,7 @@ export const BusterReactQueryProvider = ({ children }: { children: React.ReactNo useHotkeys( 'meta+shift+i', (e) => { + console.log('meta+shift+i', isDevToolsOpen); e.preventDefault(); e.stopPropagation(); setIsDevToolsOpen((prev) => !prev); @@ -77,7 +82,7 @@ export const BusterReactQueryProvider = ({ children }: { children: React.ReactNo {children} {isDevToolsOpen && ( <> - + {isDev && } {!isDev && } )} diff --git a/apps/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_DashboardFile.tsx b/apps/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_DashboardFile.tsx index 8b5e2d87f..0c50e3fa1 100644 --- a/apps/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_DashboardFile.tsx +++ b/apps/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_DashboardFile.tsx @@ -35,7 +35,7 @@ export const ChatResponseMessage_DashboardFile: React.FC<{ const { data: dashboardResponse, isError, - isFetched, + isFetched: isFetchedDashboard, isLoading } = useGetDashboard( { id, versionNumber: version_number }, @@ -91,7 +91,7 @@ export const ChatResponseMessage_DashboardFile: React.FC<{ {!hasMetrics ? null : dashboardResponse ? ( = ({ children }) => { return ['380px', 'auto']; }, [selectedLayout]); - const autoSaveId = `chat-splitter-${chatLayoutProps.chatId || '🫥'}-${chatLayoutProps.metricId || '❌'}`; + const autoSaveId = `chat-splitter-${chatLayoutProps.chatId || '🫥'}-${chatLayoutProps.dashboardId || chatLayoutProps.metricId || '❌'}`; const leftPanelMinSize = selectedFile ? DEFAULT_CHAT_OPTION_SIDEBAR_SIZE : '0px'; const leftPanelMaxSize = selectedLayout === 'both' ? MAX_CHAT_BOTH_SIDEBAR_SIZE : undefined; const rightPanelMinSize = selectedFile ? DEFAULT_FILE_OPTION_SIDEBAR_SIZE : '0px';