The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: custom report gets stuck block after deleting sql snippet (#43210)
Jordi Enricb0227cf9dcfa
diff --git a/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsx b/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsxindex d6fe1a27cee..34f540c3842 100644--- a/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsx+++ b/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsx@@ -63,8 +63,8 @@ export const ReportBlock = ({refetchOnWindowFocus: false,refetchOnMount: false,refetchIntervalInBackground: false,- retry: (failureCount: number) => {- if (failureCount >= 2) return false+ retry: (failureCount: number, error) => {+ if (error.code === 404 || failureCount >= 2) return falsereturn true},}@@ -151,18 +151,16 @@ export const ReportBlock = ({? String(executeSqlError): undefined}- isExecuting={executeSqlLoading}+ isExecuting={!contentError && executeSqlLoading}isWriteQuery={isWriteQuery}actions={- !isLoadingContent && (- <ButtonTooltip- type="text"- icon={<X />}- className="w-7 h-7"- onClick={() => onRemoveChart({ metric: { key: item.attribute } })}- tooltip={{ content: { side: 'bottom', text: 'Remove chart' } }}- />- )+ <ButtonTooltip+ type="text"+ icon={<X />}+ className="w-7 h-7"+ onClick={() => onRemoveChart({ metric: { key: item.attribute } })}+ tooltip={{ content: { side: 'bottom', text: 'Remove chart' } }}+ />}onExecute={(queryType) => {refetch()diff --git a/apps/studio/components/ui/QueryBlock/QueryBlock.tsx b/apps/studio/components/ui/QueryBlock/QueryBlock.tsxindex c8a4bf9a38c..d6d530ebbe3 100644--- a/apps/studio/components/ui/QueryBlock/QueryBlock.tsx+++ b/apps/studio/components/ui/QueryBlock/QueryBlock.tsx@@ -146,59 +146,62 @@ export const QueryBlock = ({label={label}badge={isWriteQuery && <Badge variant="warning">Write</Badge>}actions={- disabled ? null : (- <>- <ButtonTooltip- type="text"- size="tiny"- className="w-7 h-7"- icon={<Code size={14} strokeWidth={1.5} />}- onClick={() => setShowSql(!showSql)}- tooltip={{- content: { side: 'bottom', text: showSql ? 'Hide query' : 'Show query' },- }}- />- {hasResults && (- <BlockViewConfiguration- view={view}- isChart={view === 'chart'}- lockColumns={false}- chartConfig={chartSettings}- columns={Object.keys(results?.[0] ?? {})}- changeView={(nextView) => {- if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: { view: nextView } })- setChartSettings({ ...chartSettings, view: nextView })- }}- updateChartConfig={(config) => {- if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: config })- setChartSettings(config)+ <>+ {!disabled && (+ <>+ <ButtonTooltip+ type="text"+ size="tiny"+ className="w-7 h-7"+ icon={<Code size={14} strokeWidth={1.5} />}+ onClick={() => setShowSql(!showSql)}+ tooltip={{+ content: { side: 'bottom', text: showSql ? 'Hide query' : 'Show query' },}}/>- )}+ {hasResults && (+ <BlockViewConfiguration+ view={view}+ isChart={view === 'chart'}+ lockColumns={false}+ chartConfig={chartSettings}+ columns={Object.keys(results?.[0] ?? {})}+ changeView={(nextView) => {+ if (onUpdateChartConfig)+ onUpdateChartConfig({ chartConfig: { view: nextView } })+ setChartSettings({ ...chartSettings, view: nextView })+ }}+ updateChartConfig={(config) => {+ if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: config })+ setChartSettings(config)+ }}+ />+ )}- <EditQueryButton id={id} title={label} sql={sql} />- <ButtonTooltip- type="text"- size="tiny"- className="w-7 h-7"- icon={<Play size={14} strokeWidth={1.5} />}- loading={isExecuting}- disabled={isExecuting || disabled || !sql}- onClick={runSelect}- tooltip={{- content: {- side: 'bottom',- className: 'max-w-56 text-center',- text: isExecuting- ? 'Query is running. Check the SQL Editor to manage running queries.'- : 'Run query',- },- }}- />+ <EditQueryButton id={id} title={label} sql={sql} />+ <ButtonTooltip+ type="text"+ size="tiny"+ className="w-7 h-7"+ icon={<Play size={14} strokeWidth={1.5} />}+ loading={isExecuting}+ disabled={isExecuting || disabled || !sql}+ onClick={runSelect}+ tooltip={{+ content: {+ side: 'bottom',+ className: 'max-w-56 text-center',+ text: isExecuting+ ? 'Query is running. Check the SQL Editor to manage running queries.'+ : 'Run query',+ },+ }}+ />+ </>+ )}- {actions}- </>- )+ {actions}+ </>}>{!!showWarning && !blockWriteQueries && (