diff --git a/packages/builder/src/pages/[application]/backend/model/_layout.svelte b/packages/builder/src/pages/[application]/backend/model/_layout.svelte index 7f36f26d22..ee17644f3a 100644 --- a/packages/builder/src/pages/[application]/backend/model/_layout.svelte +++ b/packages/builder/src/pages/[application]/backend/model/_layout.svelte @@ -8,6 +8,8 @@ } onMount(async () => { + // navigate to first model in list, if not already selected + // and this is the final url (i.e. no selectedModel) if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { $goto(`./${$backendUiStore.models[0]._id}`) } diff --git a/packages/builder/src/pages/[application]/backend/model/index.svelte b/packages/builder/src/pages/[application]/backend/model/index.svelte index da83f587f5..15a08b1d09 100644 --- a/packages/builder/src/pages/[application]/backend/model/index.svelte +++ b/packages/builder/src/pages/[application]/backend/model/index.svelte @@ -8,7 +8,10 @@ } onMount(async () => { + // navigate to first model in list, if not already selected + // and this is the final url (i.e. no selectedModel) if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { + // this file routes as .../models/index, so, go up one. $goto(`../${$backendUiStore.models[0]._id}`) } })