Skip to content

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

Fix listEncryptedCOlumns

Joshen Limab5fa79bdf3b
diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index ea47a43eddd..58e2adba72d 100644
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@ -5,7 +5,7 @@ import { find, isUndefined } from 'lodash'
import { PostgresColumn, PostgresTable } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { checkPermissions, useStore } from 'hooks'
+import { checkPermissions, useFlag, useStore } from 'hooks'
import GridHeaderActions from './GridHeaderActions'
import NotFoundState from './NotFoundState'
import SidePanelEditor from './SidePanelEditor'
@@ -60,14 +60,15 @@ const TableGridEditor: FC<Props> = ({
const projectRef = ui.selectedProject?.ref
const [encryptedColumns, setEncryptedColumns] = useState([])
+ const isVaultEnabled = useFlag('vaultExtension')
const getEncryptedColumns = async (table: any) => {
- const columns = await vault.listEncryptedColumns(table.name)
+ const columns = await vault.listEncryptedColumns(table.schema, table.name)
setEncryptedColumns(columns)
}
useEffect(() => {
- if (selectedTable !== undefined && selectedTable.id !== undefined) {
+ if (selectedTable !== undefined && selectedTable.id !== undefined && isVaultEnabled) {
getEncryptedColumns(selectedTable)
}
}, [selectedTable?.id])
diff --git a/studio/stores/project/VaultStore.ts b/studio/stores/project/VaultStore.ts
index a8c6f220171..a470a864470 100644
--- a/studio/stores/project/VaultStore.ts
+++ b/studio/stores/project/VaultStore.ts
@@ -21,7 +21,7 @@ export interface IVaultStore {
updateSecret: (id: string, payload: Partial<VaultSecret>) => any
deleteSecret: (id: string) => any
fetchSecretValue: (id: string) => any
- listEncryptedColumns: (table: string) => any
+ listEncryptedColumns: (schema: string, table: string) => any
}
interface EncryptionKey {
@@ -208,9 +208,10 @@ export default class VaultStore implements IVaultStore {
return res[0].decrypted_secret
}
- async listEncryptedColumns(table: string) {
+ async listEncryptedColumns(schema: string, table: string) {
if (!table) return []
+ await this.rootStore.meta.schemas.loadViews(schema)
const decryptedView = this.rootStore.meta.schemas.views.find(
(view) => view.name === `decrypted_${table}`
)