Browse Source

bugfix: delete component sometimes breaks navigation

pull/420/head
Michael Shanks 6 years ago
parent
commit
3fc9fbfd39
  1. 12
      packages/builder/src/pages/[application]/frontend/[page]/[screen]/_layout.svelte

12
packages/builder/src/pages/[application]/frontend/[page]/[screen]/_layout.svelte

@ -38,15 +38,21 @@
// Loop through each ID // Loop through each ID
ids.forEach(id => { ids.forEach(id => {
// Find ID and select it // Find ID
componentToSelect = currentChildren.find(child => child._id === id) const component = currentChildren.find(child => child._id === id)
// If it does not exist, ignore (use last valid route)
if (!component) return
componentToSelect = component
// Update childrens array to selected components children // Update childrens array to selected components children
currentChildren = componentToSelect._children currentChildren = componentToSelect._children
}) })
// Select Component! // Select Component!
store.selectComponent(componentToSelect) if (componentToSelect)
store.selectComponent(componentToSelect)
} }
</script> </script>

Loading…
Cancel
Save