Skip to content

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

Fetch encrypted columns after saving an encrypted colun

Joshen Lim75883c0dd245
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
index a59466a4f18..e63f73c19bf 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
@@ -30,7 +30,7 @@ interface Props {
// Because the panel is shared between grid editor and database pages
// Both require different responses upon success of these events
onTableCreated?: (table: PostgresTable) => void
- onColumnSaved?: () => void
+ onColumnSaved?: (hasEncryptedColumns?: boolean) => void
}
const SidePanelEditor: FC<Props> = ({
@@ -144,7 +144,7 @@ const SidePanelEditor: FC<Props> = ({
ui.setNotification({ category: 'error', message: response.error.message })
} else {
await meta.tables.loadById(selectedTable!.id)
- onColumnSaved()
+ onColumnSaved(configuration.isEncrypted)
setIsEdited(false)
closePanel()
}
diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index c0983274273..1b924b69d2f 100644
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@ -61,21 +61,15 @@ const TableGridEditor: FC<Props> = ({
const [encryptedColumns, setEncryptedColumns] = useState([])
- useEffect(() => {
- let cancel = false
-
- const getEncryptedColumns = async (table: any) => {
- const columns = await vault.listEncryptedColumns(table.name)
- if (!cancel) setEncryptedColumns(columns)
- }
+ const getEncryptedColumns = async (table: any) => {
+ const columns = await vault.listEncryptedColumns(table.name)
+ setEncryptedColumns(columns)
+ }
+ useEffect(() => {
if (selectedTable !== undefined) {
getEncryptedColumns(selectedTable)
}
-
- return () => {
- cancel = true
- }
}, [selectedTable])
if (isUndefined(selectedTable)) {
@@ -112,6 +106,11 @@ const TableGridEditor: FC<Props> = ({
if (gridRef.current) gridRef.current.rowEdited(row, idx)
}
+ const onColumnSaved = (hasEncryptedColumns = false) => {
+ if (hasEncryptedColumns) {
+ }
+ }
+
const onTableCreated = (table: PostgresTable) => {
router.push(`/project/${projectRef}/editor/${table.id}`)
}
@@ -191,6 +190,7 @@ const TableGridEditor: FC<Props> = ({
sidePanelKey={sidePanelKey}
onRowCreated={onRowCreated}
onRowUpdated={onRowUpdated}
+ onColumnSaved={onColumnSaved}
onTableCreated={onTableCreated}
closePanel={onClosePanel}
/>