diff --git a/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsx b/apps/studio/components/interfaces/Reports/ReportBlock/ReportBlock.tsx index 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 false return true }, } @@ -151,18 +151,16 @@ export const ReportBlock = ({ ? String(executeSqlError) : undefined } - isExecuting={executeSqlLoading} + isExecuting={!contentError && executeSqlLoading} isWriteQuery={isWriteQuery} actions={ - !isLoadingContent && ( - } - className="w-7 h-7" - onClick={() => onRemoveChart({ metric: { key: item.attribute } })} - tooltip={{ content: { side: 'bottom', text: 'Remove chart' } }} - /> - ) + } + 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.tsx index 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 && Write} actions={ - disabled ? null : ( - <> - } - onClick={() => setShowSql(!showSql)} - tooltip={{ - content: { side: 'bottom', text: showSql ? 'Hide query' : 'Show query' }, - }} - /> - {hasResults && ( - { - if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: { view: nextView } }) - setChartSettings({ ...chartSettings, view: nextView }) - }} - updateChartConfig={(config) => { - if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: config }) - setChartSettings(config) + <> + {!disabled && ( + <> + } + onClick={() => setShowSql(!showSql)} + tooltip={{ + content: { side: 'bottom', text: showSql ? 'Hide query' : 'Show query' }, }} /> - )} + {hasResults && ( + { + if (onUpdateChartConfig) + onUpdateChartConfig({ chartConfig: { view: nextView } }) + setChartSettings({ ...chartSettings, view: nextView }) + }} + updateChartConfig={(config) => { + if (onUpdateChartConfig) onUpdateChartConfig({ chartConfig: config }) + setChartSettings(config) + }} + /> + )} - - } - 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', - }, - }} - /> + + } + 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 && (