mirror of https://github.com/buster-so/buster.git
Merge pull request #518 from buster-so/hot-fix/dashboard-localstorage
Hot fix/dashboard localstorage
This commit is contained in:
commit
47f14a63f6
|
@ -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
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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({});
|
||||
|
|
|
@ -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 && (
|
||||
<>
|
||||
<ReactQueryDevtools initialIsOpen={true} />
|
||||
{isDev && <ReactQueryDevtools initialIsOpen={true} />}
|
||||
{!isDev && <ReactQueryDevtoolsProduction />}
|
||||
</>
|
||||
)}
|
||||
|
|
|
@ -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 ? (
|
||||
<Content
|
||||
dashboardResponse={dashboardResponse}
|
||||
isFetched={isFetched}
|
||||
isFetched={isFetchedDashboard}
|
||||
metricId={metricId}
|
||||
dashboardId={dashboardId}
|
||||
chatId={chatId}
|
||||
|
|
|
@ -30,7 +30,7 @@ export const ChatLayout: React.FC<ChatSplitterProps> = ({ 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';
|
||||
|
|
Loading…
Reference in New Issue