The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix loadBySchema persisting stale data
Joshen Lim439ed764594b
diff --git a/studio/stores/common/PostgresMetaInterface.ts b/studio/stores/common/PostgresMetaInterface.tsindex 09f605b5acc..bd51fd319d5 100644--- a/studio/stores/common/PostgresMetaInterface.ts+++ b/studio/stores/common/PostgresMetaInterface.ts@@ -117,6 +117,7 @@ export default class PostgresMetaInterface<T> implements IPostgresMetaInterface<}}+ // [Joshen] Only used for tables and views for nowasync loadBySchema(schema: string) {let { LOADING, ERROR, LOADED } = this.STATEStry {@@ -132,7 +133,14 @@ export default class PostgresMetaInterface<T> implements IPostgresMetaInterface<const data = response as T[]const formattedData = keyBy(data, this.identifier)- this.data = { ...this.data, ...formattedData }+ // Purge existing data that belongs to given schema, otherwise+ // stale data will persist+ const purgedData = Object.keys(this.data)+ .map((identifier: any) => this.data[identifier])+ .filter((item: any) => item.schema !== schema)+ const formattedPurgedData = keyBy(purgedData, this.identifier)++ this.data = { ...formattedPurgedData, ...formattedData }this.setState(LOADED)return data