From fea02030965b5b866de2ffaffe321dd284d488e7 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 2 Jun 2020 10:43:48 +0100 Subject: [PATCH] bugfix: data not loading on default view --- packages/builder/src/builderStore/store/backend.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index e7cdcd7e29..f4f4c20fd2 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -30,7 +30,10 @@ export const getBackendUiStore = () => { const views = await viewsResponse.json() store.update(state => { state.selectedDatabase = db - state.selectedModel = models && models.length > 0 && models[0] + if (models && models.length > 0) { + state.selectedModel = models[0] + state.selectedView = `${models[0]._id}` + } state.breadcrumbs = [db.name] state.models = models state.views = views @@ -73,6 +76,7 @@ export const getBackendUiStore = () => { state.models.push(model) state.models = state.models state.selectedModel = model + state.selectedView = `${model._id}` return state }), },