mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
Merge pull request #13286 from supabase/fix/update-is-initialized-logic-in-postgresmetainterface
Fix is initialized logic in postgresmeta interace
This commit is contained in:
1 file changed
+3
-4
@@ -47,6 +47,7 @@ export default class PostgresMetaInterface<T> implements IPostgresMetaInterface<
|
||||
state = this.STATES.INITIAL
|
||||
data: { [key in DataKeys]: T } = {}
|
||||
headers: any = {}
|
||||
isInitialized: boolean = false
|
||||
|
||||
constructor(
|
||||
rootStore: IRootStore,
|
||||
@@ -90,10 +91,6 @@ export default class PostgresMetaInterface<T> implements IPostgresMetaInterface<
|
||||
return this.state === this.STATES.INITIAL || this.state === this.STATES.LOADING
|
||||
}
|
||||
|
||||
get isInitialized() {
|
||||
return this.state === this.STATES.LOADED || this.state === this.STATES.ERROR
|
||||
}
|
||||
|
||||
async fetchData() {
|
||||
const headers = { 'Content-Type': 'application/json', ...this.headers }
|
||||
const response = await get<T[]>(this.url, { headers })
|
||||
@@ -114,6 +111,8 @@ export default class PostgresMetaInterface<T> implements IPostgresMetaInterface<
|
||||
console.error('Load error message', e.message)
|
||||
this.setError(e)
|
||||
this.setState(ERROR)
|
||||
} finally {
|
||||
if (!this.isInitialized) this.isInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user