diff --git a/apps/web/src/api/buster_rest/dictionaries/queryRequests.ts b/apps/web/src/api/buster_rest/dictionaries/queryRequests.ts index 084aa018e..cd2bdfa65 100644 --- a/apps/web/src/api/buster_rest/dictionaries/queryRequests.ts +++ b/apps/web/src/api/buster_rest/dictionaries/queryRequests.ts @@ -1,11 +1,14 @@ import { useQuery, QueryClient } from '@tanstack/react-query'; import { getColorPalettes, getCurrencies } from './requests'; import { dictionariesQueryKeys } from '@/api/query_keys/dictionaries'; +import { useSupabaseContext } from '@/context/Supabase'; export const useColorDictionaryThemes = () => { + const isAnonymousUser = useSupabaseContext((x) => x.isAnonymousUser); return useQuery({ ...dictionariesQueryKeys.colorPalettes, - queryFn: getColorPalettes + queryFn: getColorPalettes, + enabled: !isAnonymousUser }); }; diff --git a/apps/web/src/context/Supabase/SupabaseContextProvider.tsx b/apps/web/src/context/Supabase/SupabaseContextProvider.tsx index 8797a9107..78f6336b0 100644 --- a/apps/web/src/context/Supabase/SupabaseContextProvider.tsx +++ b/apps/web/src/context/Supabase/SupabaseContextProvider.tsx @@ -23,7 +23,8 @@ const useSupabaseContextInternal = ({ const { openErrorNotification, openInfoMessage } = useBusterNotifications(); const [accessToken, setAccessToken] = useState(supabaseContext.accessToken || ''); - const isAnonymousUser = !supabaseContext.user?.id || supabaseContext.user?.is_anonymous === true; + const isAnonymousUser: boolean = + !supabaseContext.user?.id || supabaseContext.user?.is_anonymous === true; const getExpiresAt = useMemoizedFn((token?: string) => { const decoded = jwtDecode(token || accessToken); diff --git a/packages/server-shared/src/metrics/charts/chartConfigProps.ts b/packages/server-shared/src/metrics/charts/chartConfigProps.ts index e8d3bd66b..146157634 100644 --- a/packages/server-shared/src/metrics/charts/chartConfigProps.ts +++ b/packages/server-shared/src/metrics/charts/chartConfigProps.ts @@ -27,7 +27,7 @@ export const ChartConfigPropsSchema = z.object({ columnSettings: z.record(z.string(), ColumnSettingsSchema).default({}), columnLabelFormats: z.record(z.string(), ColumnLabelFormatSchema).default({}), // OPTIONAL: default is the buster color palette - colors: z.array(z.string()).optional(), + colors: z.array(z.string()).default(DEFAULT_CHART_THEME), // OPTIONAL: default is null and will be true if there are multiple Y axes or if a category axis is used showLegend: z.nullable(z.boolean()).default(null), // OPTIONAL: default: true