diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 9db23d3001..219c4f3626 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -69,20 +69,14 @@ export const getFrontendStore = () => { // Initialise backend stores const [ _integrations, - _tables, ] = await Promise.all([ - api.get("/api/integrations").then(r => r.json()), - api.get(`/api/tables`).then(r => r.json()), + api.get("/api/integrations").then(r => r.json()) ]) datasources.init() integrations.set(_integrations) queries.init() database.set(application.instance) - tables.set({ - list: _tables, - selected: {}, - draft: {}, - }) + tables.init() }, routing: { fetch: async () => { diff --git a/packages/builder/src/stores/backend/tables.js b/packages/builder/src/stores/backend/tables.js index c13a3d46ce..0992f04f23 100644 --- a/packages/builder/src/stores/backend/tables.js +++ b/packages/builder/src/stores/backend/tables.js @@ -71,10 +71,18 @@ export function createTablesStore() { return { subscribe, - set, fetch, select, save, + init: async () => { + const response = await api.get("/api/tables") + const json = await response.json() + set({ + list: json, + selected: {}, + draft: {}, + }) + }, delete: async table => { await api.delete(`/api/tables/${table._id}/${table._rev}`) update(state => ({