diff --git a/apps/studio/data/branches/branches-query.ts b/apps/studio/data/branches/branches-query.ts index 40a573a31d0..0f195c6321e 100644 --- a/apps/studio/data/branches/branches-query.ts +++ b/apps/studio/data/branches/branches-query.ts @@ -4,6 +4,7 @@ import { branchKeys } from './keys' import type { components } from '@/data/api' import { get, handleError } from '@/data/fetchers' import { IS_PLATFORM } from '@/lib/constants' +import { EMPTY_ARR } from '@/lib/void' import type { ResponseError, UseCustomQueryOptions } from '@/types' export type BranchesVariables = { @@ -22,13 +23,13 @@ export async function getBranches({ projectRef }: BranchesVariables, signal?: Ab if (error) { if ((error as ResponseError).message === 'Preview branching is not enabled for this project.') { - return [] + return EMPTY_ARR } else { handleError(error) } } - return data + return Array.isArray(data) ? data : EMPTY_ARR } export type BranchesData = Awaited> diff --git a/apps/studio/data/read-replicas/replicas-query.ts b/apps/studio/data/read-replicas/replicas-query.ts index f9e951f4158..20c32966d22 100644 --- a/apps/studio/data/read-replicas/replicas-query.ts +++ b/apps/studio/data/read-replicas/replicas-query.ts @@ -7,6 +7,7 @@ import type { components } from '@/data/api' import { get, handleError } from '@/data/fetchers' import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage' import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject' +import { EMPTY_ARR } from '@/lib/void' import type { ResponseError, UseCustomQueryOptions } from '@/types' /** @@ -47,7 +48,7 @@ export async function getReadReplicas( }) if (error) handleError(error) - return data + return Array.isArray(data) ? data : EMPTY_ARR } export type ReadReplicasData = Awaited>