diff --git a/studio/stores/common/PostgresMetaInterface.ts b/studio/stores/common/PostgresMetaInterface.ts index bd51fd319d5..72496fa116e 100644 --- a/studio/stores/common/PostgresMetaInterface.ts +++ b/studio/stores/common/PostgresMetaInterface.ts @@ -47,6 +47,7 @@ export default class PostgresMetaInterface 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 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(this.url, { headers }) @@ -114,6 +111,8 @@ export default class PostgresMetaInterface implements IPostgresMetaInterface< console.error('Load error message', e.message) this.setError(e) this.setState(ERROR) + } finally { + if (!this.isInitialized) this.isInitialized = true } }