Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Make error toasts not auto dismiss by default

Joshen Limbfa5a986e3ad
diff --git a/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx b/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
index 1f63042e15c..5503d234ac4 100644
--- a/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
+++ b/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
@@ -120,18 +120,21 @@ const PolicyEditorModal: FC<Props> = ({
return ui.setNotification({
category: 'error',
message: 'You will need to allow at one operation in your policy',
+ duration: 4000,
})
}
if (['SELECT', 'DELETE'].includes(command) && !definition) {
return ui.setNotification({
category: 'error',
message: 'Did you forget to provide a USING expression for your policy?',
+ duration: 4000,
})
}
if (command === 'INSERT' && !check) {
return ui.setNotification({
category: 'error',
message: 'Did you forget to provide a WITH CHECK expression for your policy?',
+ duration: 4000,
})
}
if (command === 'UPDATE' && !definition && !check) {
@@ -139,6 +142,7 @@ const PolicyEditorModal: FC<Props> = ({
category: 'error',
message:
'You will need to provide either a USING, or WITH CHECK expression, or both for your policy',
+ duration: 4000,
})
}
const policySQLStatement = createSQLPolicy(policyFormFields, selectedPolicyToEdit)
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
index 2298bc6cddb..67ce557846c 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
@@ -33,8 +33,8 @@ const JsonEdit: FC<JsonEditProps> = ({ column, jsonString, visible, closePanel,
} catch (error: any) {
const message = error.message
? `Error: ${error.message}`
- : 'Hmm, invalid JSON seems to have an invalid structure.'
- ui.setNotification({ category: 'error', message })
+ : 'JSON seems to have an invalid structure.'
+ ui.setNotification({ category: 'error', message, duration: 4000 })
} finally {
resolve()
}
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
index 40dc8b0ac7e..02d985c796d 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
@@ -82,6 +82,7 @@ const RowEditor: FC<Props> = ({
ui.setNotification({
category: 'error',
message: `Please enter a value in the ${row.name} field first`,
+ duration: 4000,
})
}
const foreignKey = row.foreignKey
@@ -108,6 +109,7 @@ const RowEditor: FC<Props> = ({
return ui.setNotification({
category: 'error',
message: `Unable to find the corresponding row in ${foreignKey.target_table_schema}.${foreignKey.target_table_name} where ${foreignKey.target_column_name} equals ${row.value}`,
+ duration: 4000,
})
}
setReferenceRow({ loading: false, foreignKey, row: res[0] })
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadsheetImport.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadsheetImport.tsx
index ea9618c96f1..2b80a7340d2 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadsheetImport.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/SpreadsheetImport/SpreadsheetImport.tsx
@@ -74,6 +74,7 @@ const SpreadsheetImport: FC<Props> = ({
error: errors,
category: 'error',
message: `Some issues have been detected on ${errors.length} rows. More details below the content preview.`,
+ duration: 4000,
})
}
setErrors(errors)
@@ -98,6 +99,7 @@ const SpreadsheetImport: FC<Props> = ({
error: errors,
category: 'error',
message: `Some issues have been detected on ${errors.length} rows. More details below the content preview.`,
+ duration: 4000,
})
}
setErrors(errors)
@@ -160,7 +162,7 @@ const SpreadsheetImport: FC<Props> = ({
</div>
{spreadsheetData.headers.length > 0 && (
- <div className="py-5 space-y-5">
+ <div className="space-y-5 py-5">
<div className="space-y-2">
<div className="flex flex-col space-y-1">
<Typography.Text>Content Preview</Typography.Text>
@@ -188,7 +190,7 @@ const SpreadsheetImport: FC<Props> = ({
<div key={key} className="space-y-2">
<div className="flex items-center space-x-2">
<IconChevronRight
- className={`cursor-pointer transform ${isExpanded ? 'rotate-90' : ''}`}
+ className={`transform cursor-pointer ${isExpanded ? 'rotate-90' : ''}`}
size={14}
onClick={() => onSelectExpandError(key)}
/>
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
index 6fcba4fe396..466aa6d0ccc 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
@@ -99,7 +99,7 @@ const TableEditor: FC<Props> = ({
if (tableFields) {
const errors: any = validateFields(tableFields)
if (errors.columns) {
- ui.setNotification({ category: 'error', message: errors.columns })
+ ui.setNotification({ category: 'error', message: errors.columns, duration: 4000 })
}
setErrors(errors)
diff --git a/studio/hooks/misc/useStore.tsx b/studio/hooks/misc/useStore.tsx
index 15f553cb98b..b267cb010a4 100644
--- a/studio/hooks/misc/useStore.tsx
+++ b/studio/hooks/misc/useStore.tsx
@@ -58,7 +58,7 @@ export const StoreProvider: FC<StoreProvider> = ({ children, rootStore }) => {
return toast.success(message, { id, duration: toastDuration })
case 'error':
console.error('Error:', { error, message })
- return toast.error(message, { id, duration: toastDuration })
+ return toast.error(message, { id, duration: duration || Infinity })
case 'loading':
if (progress) {
return toast.loading(