Refactoring to replace the use of frontend store.screens with derived allScreens and currentScreens.
This commit is contained in:
parent
768298f733
commit
d57368eb8b
packages/builder/src
builderStore
components
backend/TableNavigator/popovers
userInterface
pages/[application]/design/[page]/[screen]
|
@ -1,5 +1,7 @@
|
||||||
import { walkProps } from "./storeUtils"
|
import { walkProps } from "./storeUtils"
|
||||||
import { get_capitalised_name } from "../helpers"
|
import { get_capitalised_name } from "../helpers"
|
||||||
|
import { get } from "svelte/store"
|
||||||
|
import { allScreens } from "builderStore"
|
||||||
|
|
||||||
export default function(component, state) {
|
export default function(component, state) {
|
||||||
const capitalised = get_capitalised_name(
|
const capitalised = get_capitalised_name(
|
||||||
|
@ -25,7 +27,7 @@ export default function(component, state) {
|
||||||
findMatches(state.currentPreviewItem.props)
|
findMatches(state.currentPreviewItem.props)
|
||||||
} else {
|
} else {
|
||||||
// viewing master page - need to find against all screens
|
// viewing master page - need to find against all screens
|
||||||
for (let screen of state.screens) {
|
for (let screen of get(allScreens)) {
|
||||||
findMatches(screen.props)
|
findMatches(screen.props)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,34 @@
|
||||||
// import { getStore } from "./store"
|
|
||||||
import { getFrontendStore } from "./store/frontend"
|
import { getFrontendStore } from "./store/frontend"
|
||||||
import { getBackendUiStore } from "./store/backend"
|
import { getBackendUiStore } from "./store/backend"
|
||||||
import { getAutomationStore } from "./store/automation/"
|
import { getAutomationStore } from "./store/automation/"
|
||||||
import { getThemeStore } from "./store/theme"
|
import { getThemeStore } from "./store/theme"
|
||||||
|
import { derived } from "svelte/store"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
|
||||||
// export const store = getStore()
|
|
||||||
export const store = getFrontendStore()
|
export const store = getFrontendStore()
|
||||||
export const backendUiStore = getBackendUiStore()
|
export const backendUiStore = getBackendUiStore()
|
||||||
export const automationStore = getAutomationStore()
|
export const automationStore = getAutomationStore()
|
||||||
export const themeStore = getThemeStore()
|
export const themeStore = getThemeStore()
|
||||||
|
|
||||||
|
export const allScreens = derived(store, $store => {
|
||||||
|
let screens = []
|
||||||
|
if ($store.pages == null) {
|
||||||
|
return screens
|
||||||
|
}
|
||||||
|
for (let page of Object.values($store.pages)) {
|
||||||
|
screens = screens.concat(page._screens)
|
||||||
|
}
|
||||||
|
return screens
|
||||||
|
})
|
||||||
|
|
||||||
|
export const currentScreens = derived(store, $store => {
|
||||||
|
const currentScreens = $store.pages[$store.currentPageName]?._screens
|
||||||
|
if (currentScreens == null) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return Array.isArray(currentScreens) ? currentScreens : Object.values(currentScreens)
|
||||||
|
})
|
||||||
|
|
||||||
export const initialise = async () => {
|
export const initialise = async () => {
|
||||||
try {
|
try {
|
||||||
await analytics.activate()
|
await analytics.activate()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { writable, get, derived } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import {
|
import {
|
||||||
createProps,
|
createProps,
|
||||||
|
@ -6,7 +6,7 @@ import {
|
||||||
getBuiltin,
|
getBuiltin,
|
||||||
} from "components/userInterface/pagesParsing/createProps"
|
} from "components/userInterface/pagesParsing/createProps"
|
||||||
import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents"
|
import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents"
|
||||||
import { backendUiStore } from "builderStore"
|
import { backendUiStore, allScreens } from "builderStore"
|
||||||
import { generate_screen_css } from "../generate_css"
|
import { generate_screen_css } from "../generate_css"
|
||||||
import { fetchComponentLibDefinitions } from "../loadComponentLibraries"
|
import { fetchComponentLibDefinitions } from "../loadComponentLibraries"
|
||||||
import api from "../api"
|
import api from "../api"
|
||||||
|
@ -41,16 +41,6 @@ const INITIAL_FRONTEND_STATE = {
|
||||||
export const getFrontendStore = () => {
|
export const getFrontendStore = () => {
|
||||||
const store = writable({ ...INITIAL_FRONTEND_STATE })
|
const store = writable({ ...INITIAL_FRONTEND_STATE })
|
||||||
|
|
||||||
store.allScreens = derived(store.pages, $pages => {
|
|
||||||
let screens = []
|
|
||||||
if ($pages) {
|
|
||||||
for (let page of Object.values($pages)) {
|
|
||||||
screens = screens.concat(page._screens)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return screens
|
|
||||||
})
|
|
||||||
|
|
||||||
store.actions = {
|
store.actions = {
|
||||||
// TODO: REFACTOR
|
// TODO: REFACTOR
|
||||||
initialise: async pkg => {
|
initialise: async pkg => {
|
||||||
|
@ -110,10 +100,7 @@ export const getFrontendStore = () => {
|
||||||
appId: pkg.application._id,
|
appId: pkg.application._id,
|
||||||
pages: pkg.pages,
|
pages: pkg.pages,
|
||||||
hasAppPackage: true,
|
hasAppPackage: true,
|
||||||
screens: [
|
currentScreens: [],
|
||||||
...Object.values(mainScreens),
|
|
||||||
...Object.values(unauthScreens),
|
|
||||||
],
|
|
||||||
builtins: [getBuiltin("##builtin/screenslot")],
|
builtins: [getBuiltin("##builtin/screenslot")],
|
||||||
appInstance: pkg.application.instance,
|
appInstance: pkg.application.instance,
|
||||||
}))
|
}))
|
||||||
|
@ -138,7 +125,7 @@ export const getFrontendStore = () => {
|
||||||
screens: {
|
screens: {
|
||||||
select: screenName => {
|
select: screenName => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
const screen = getExactComponent(state.allScreens, screenName, true)
|
const screen = getExactComponent(get(allScreens), screenName, true)
|
||||||
state.currentPreviewItem = screen
|
state.currentPreviewItem = screen
|
||||||
state.currentFrontEndType = "screen"
|
state.currentFrontEndType = "screen"
|
||||||
state.currentView = "detail"
|
state.currentView = "detail"
|
||||||
|
@ -195,7 +182,6 @@ export const getFrontendStore = () => {
|
||||||
// TODO: should carry out all server updates to screen in a single call
|
// TODO: should carry out all server updates to screen in a single call
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.pages[pageName]._screens = currentPageScreens
|
state.pages[pageName]._screens = currentPageScreens
|
||||||
state.screens = currentPageScreens
|
|
||||||
state.currentPreviewItem = screen
|
state.currentPreviewItem = screen
|
||||||
const safeProps = makePropsSafe(
|
const safeProps = makePropsSafe(
|
||||||
state.components[screen.props._component],
|
state.components[screen.props._component],
|
||||||
|
@ -227,9 +213,6 @@ export const getFrontendStore = () => {
|
||||||
for (let screenToDelete of Array.isArray(screenToDelete)
|
for (let screenToDelete of Array.isArray(screenToDelete)
|
||||||
? screenToDelete
|
? screenToDelete
|
||||||
: [screenToDelete]) {
|
: [screenToDelete]) {
|
||||||
state.screens = state.screens.filter(
|
|
||||||
screen => screen.name !== screenToDelete.name
|
|
||||||
)
|
|
||||||
// Remove screen from current page as well
|
// Remove screen from current page as well
|
||||||
// TODO: Should be done server side
|
// TODO: Should be done server side
|
||||||
state.pages[pageName]._screens = state.pages[
|
state.pages[pageName]._screens = state.pages[
|
||||||
|
@ -256,16 +239,12 @@ export const getFrontendStore = () => {
|
||||||
pages: {
|
pages: {
|
||||||
select: pageName => {
|
select: pageName => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
const current_screens = state.pages[pageName]._screens
|
|
||||||
|
|
||||||
const currentPage = state.pages[pageName]
|
const currentPage = state.pages[pageName]
|
||||||
|
|
||||||
|
state.currentScreens = currentPage._screens
|
||||||
state.currentFrontEndType = "page"
|
state.currentFrontEndType = "page"
|
||||||
state.currentView = "detail"
|
state.currentView = "detail"
|
||||||
state.currentPageName = pageName
|
state.currentPageName = pageName
|
||||||
state.screens = Array.isArray(current_screens)
|
|
||||||
? current_screens
|
|
||||||
: Object.values(current_screens)
|
|
||||||
|
|
||||||
// This is the root of many problems.
|
// This is the root of many problems.
|
||||||
// Uncaught (in promise) TypeError: Cannot read property '_component' of undefined
|
// Uncaught (in promise) TypeError: Cannot read property '_component' of undefined
|
||||||
|
@ -280,7 +259,7 @@ export const getFrontendStore = () => {
|
||||||
state.currentPreviewItem = state.pages[pageName]
|
state.currentPreviewItem = state.pages[pageName]
|
||||||
store.actions.screens.regenerateCssForCurrentScreen()
|
store.actions.screens.regenerateCssForCurrentScreen()
|
||||||
|
|
||||||
for (let screen of state.screens) {
|
for (let screen of get(allScreens)) {
|
||||||
screen._css = generate_screen_css([screen.props])
|
screen._css = generate_screen_css([screen.props])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
import {makePropsSafe} from "../../../../components/userInterface/pagesParsing/createProps"
|
|
||||||
import {generate_screen_css} from "../../../generate_css"
|
|
||||||
import {get} from "svelte/store"
|
|
||||||
import api from "../../../api"
|
|
||||||
import { store } from "builderStore"
|
|
||||||
|
|
||||||
class Page {
|
|
||||||
constructor(page) {
|
|
||||||
this.pageName = page.name
|
|
||||||
this.pageObj = page
|
|
||||||
}
|
|
||||||
|
|
||||||
select() {
|
|
||||||
store.update(state => {
|
|
||||||
const pageName = this.pageName
|
|
||||||
const current_screens = state.pages[pageName]._screens
|
|
||||||
|
|
||||||
const currentPage = state.pages[pageName]
|
|
||||||
|
|
||||||
state.currentFrontEndType = "page"
|
|
||||||
state.currentView = "detail"
|
|
||||||
state.currentPageName = pageName
|
|
||||||
state.screens = Array.isArray(current_screens)
|
|
||||||
? current_screens
|
|
||||||
: Object.values(current_screens)
|
|
||||||
|
|
||||||
// This is the root of many problems.
|
|
||||||
// Uncaught (in promise) TypeError: Cannot read property '_component' of undefined
|
|
||||||
// it appears that the currentPage sometimes has _props instead of props
|
|
||||||
// why
|
|
||||||
const safeProps = makePropsSafe(
|
|
||||||
state.components[currentPage.props._component],
|
|
||||||
currentPage.props
|
|
||||||
)
|
|
||||||
state.currentComponentInfo = safeProps
|
|
||||||
currentPage.props = safeProps
|
|
||||||
state.currentPreviewItem = state.pages[pageName]
|
|
||||||
store.actions.screens.regenerateCssForCurrentScreen()
|
|
||||||
|
|
||||||
for (let screen of state.screens) {
|
|
||||||
screen._css = generate_screen_css([screen.props])
|
|
||||||
}
|
|
||||||
|
|
||||||
return state
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async save() {
|
|
||||||
const page = this.pageObj
|
|
||||||
const storeContents = get(store)
|
|
||||||
const pageName = storeContents.currentPageName || "main"
|
|
||||||
const pageToSave = page || storeContents.pages[pageName]
|
|
||||||
|
|
||||||
// TODO: revisit. This sends down a very weird payload
|
|
||||||
const response = await api
|
|
||||||
.post(`/api/pages/${pageToSave._id}`, {
|
|
||||||
page: {
|
|
||||||
componentLibraries: storeContents.pages.componentLibraries,
|
|
||||||
...pageToSave,
|
|
||||||
},
|
|
||||||
screens: pageToSave._screens,
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
|
|
||||||
store.update(state => {
|
|
||||||
state.pages[pageName]._rev = response.rev
|
|
||||||
return state
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { backendUiStore, store } from "builderStore"
|
import { backendUiStore, store, allScreens } from "builderStore"
|
||||||
import { notifier } from "builderStore/store/notifications"
|
import { notifier } from "builderStore/store/notifications"
|
||||||
import { DropdownMenu, Button, Input } from "@budibase/bbui"
|
import { DropdownMenu, Button, Input } from "@budibase/bbui"
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function showModal() {
|
function showModal() {
|
||||||
const screens = $store.screens
|
const screens = $allScreens
|
||||||
templateScreens = screens.filter(screen => screen.autoTableId === table._id)
|
templateScreens = screens.filter(screen => screen.autoTableId === table._id)
|
||||||
willBeDeleted = ["All table data"].concat(
|
willBeDeleted = ["All table data"].concat(
|
||||||
templateScreens.map(screen => `Screen ${screen.props._instanceName}`)
|
templateScreens.map(screen => `Screen ${screen.props._instanceName}`)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { store } from "builderStore/"
|
import { store, allScreens } from "builderStore"
|
||||||
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
|
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
|
||||||
import ComponentSelectionList from "./ComponentSelectionList.svelte"
|
import ComponentSelectionList from "./ComponentSelectionList.svelte"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
{#if $store.currentFrontEndType === 'page' || $store.screens.length}
|
{#if $store.currentFrontEndType === 'page' || $allScreens.length}
|
||||||
<div class="switcher">
|
<div class="switcher">
|
||||||
<button
|
<button
|
||||||
class:selected={selected === COMPONENT_SELECTION_TAB}
|
class:selected={selected === COMPONENT_SELECTION_TAB}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { DataList } from "@budibase/bbui"
|
import { DataList } from "@budibase/bbui"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import { store } from "builderStore"
|
import { allScreens } from "builderStore"
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
const getUrls = () => {
|
const getUrls = () => {
|
||||||
return [
|
return [
|
||||||
...$store.screens
|
...$allScreens
|
||||||
.filter(
|
.filter(
|
||||||
screen =>
|
screen =>
|
||||||
screen.props._component.endsWith("/rowdetail") ||
|
screen.props._component.endsWith("/rowdetail") ||
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Input, DataList, Select } from "@budibase/bbui"
|
import { Input, DataList, Select } from "@budibase/bbui"
|
||||||
import { store, automationStore } from "builderStore"
|
import { automationStore, allScreens } from "builderStore"
|
||||||
|
|
||||||
export let parameter
|
export let parameter
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
{:else if parameter.name === 'url'}
|
{:else if parameter.name === 'url'}
|
||||||
<DataList on:change bind:value={parameter.value}>
|
<DataList on:change bind:value={parameter.value}>
|
||||||
<option value="" />
|
<option value="" />
|
||||||
{#each $store.screens as screen}
|
{#each $allScreens as screen}
|
||||||
<option value={screen.route}>{screen.props._instanceName}</option>
|
<option value={screen.route}>{screen.props._instanceName}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</DataList>
|
</DataList>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { DataList, Label } from "@budibase/bbui"
|
import { DataList, Label } from "@budibase/bbui"
|
||||||
import { store } from "builderStore"
|
import { allScreens } from "builderStore"
|
||||||
|
|
||||||
export let parameters
|
export let parameters
|
||||||
</script>
|
</script>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
<Label size="m" color="dark">Screen</Label>
|
<Label size="m" color="dark">Screen</Label>
|
||||||
<DataList secondary bind:value={parameters.url}>
|
<DataList secondary bind:value={parameters.url}>
|
||||||
<option value="" />
|
<option value="" />
|
||||||
{#each $store.screens as screen}
|
{#each $allScreens as screen}
|
||||||
<option value={screen.route}>{screen.props._instanceName}</option>
|
<option value={screen.route}>{screen.props._instanceName}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</DataList>
|
</DataList>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { store } from "builderStore"
|
import { store, currentScreens } from "builderStore"
|
||||||
import ComponentsHierarchy from "components/userInterface/ComponentsHierarchy.svelte"
|
import ComponentsHierarchy from "components/userInterface/ComponentsHierarchy.svelte"
|
||||||
import PageLayout from "components/userInterface/PageLayout.svelte"
|
import PageLayout from "components/userInterface/PageLayout.svelte"
|
||||||
import PagesList from "components/userInterface/PagesList.svelte"
|
import PagesList from "components/userInterface/PagesList.svelte"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<PagesList />
|
<PagesList />
|
||||||
<div class="nav-items-container">
|
<div class="nav-items-container">
|
||||||
<PageLayout layout={$store.pages[$store.currentPageName]} />
|
<PageLayout layout={$store.pages[$store.currentPageName]} />
|
||||||
<ComponentsHierarchy screens={$store.screens} />
|
<ComponentsHierarchy screens={$currentScreens} />
|
||||||
</div>
|
</div>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<NewScreenModal />
|
<NewScreenModal />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@sveltech/routify"
|
import { goto } from "@sveltech/routify"
|
||||||
import { store, backendUiStore } from "builderStore"
|
import { store, backendUiStore, allScreens } from "builderStore"
|
||||||
import {
|
import {
|
||||||
Input,
|
Input,
|
||||||
Button,
|
Button,
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
$: templates = getTemplates($store, $backendUiStore.tables)
|
$: templates = getTemplates($store, $backendUiStore.tables)
|
||||||
|
|
||||||
$: route = !route && $store.screens.length === 0 ? "*" : route
|
$: route = !route && $allScreens.length === 0 ? "*" : route
|
||||||
|
|
||||||
$: baseComponents = Object.values($store.components)
|
$: baseComponents = Object.values($store.components)
|
||||||
.filter(componentDefinition => componentDefinition.baseComponent)
|
.filter(componentDefinition => componentDefinition.baseComponent)
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const routeNameExists = route => {
|
const routeNameExists = route => {
|
||||||
return $store.screens.some(
|
return $allScreens.some(
|
||||||
screen => screen.route.toLowerCase() === route.toLowerCase()
|
screen => screen.route.toLowerCase() === route.toLowerCase()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { DataList } from "@budibase/bbui"
|
import { DataList } from "@budibase/bbui"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import { store, backendUiStore } from "builderStore"
|
import { store, allScreens, backendUiStore } from "builderStore"
|
||||||
import fetchBindableProperties from "builderStore/fetchBindableProperties"
|
import fetchBindableProperties from "builderStore/fetchBindableProperties"
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
// and substitute the :id param for the actual {{ ._id }} binding
|
// and substitute the :id param for the actual {{ ._id }} binding
|
||||||
const getUrls = () => {
|
const getUrls = () => {
|
||||||
const urls = [
|
const urls = [
|
||||||
...$store.screens
|
...$allScreens
|
||||||
.filter(screen => !screen.props._component.endsWith("/rowdetail"))
|
.filter(screen => !screen.props._component.endsWith("/rowdetail"))
|
||||||
.map(screen => ({
|
.map(screen => ({
|
||||||
name: screen.props._instanceName,
|
name: screen.props._instanceName,
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
tables: $backendUiStore.tables,
|
tables: $backendUiStore.tables,
|
||||||
})
|
})
|
||||||
|
|
||||||
const detailScreens = $store.screens.filter(screen =>
|
const detailScreens = $allScreens.filter(screen =>
|
||||||
screen.props._component.endsWith("/rowdetail")
|
screen.props._component.endsWith("/rowdetail")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import Input from "./PropertyPanelControls/Input.svelte"
|
import Input from "./PropertyPanelControls/Input.svelte"
|
||||||
import { goto } from "@sveltech/routify"
|
import { goto } from "@sveltech/routify"
|
||||||
import { excludeProps } from "./propertyCategories.js"
|
import { excludeProps } from "./propertyCategories.js"
|
||||||
import { store } from "builderStore"
|
import { store, allScreens } from "builderStore"
|
||||||
import { walkProps } from "builderStore/storeUtils"
|
import { walkProps } from "builderStore/storeUtils"
|
||||||
|
|
||||||
export let panelDefinition = []
|
export let panelDefinition = []
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
lookForDuplicate($store.currentPreviewItem.props)
|
lookForDuplicate($store.currentPreviewItem.props)
|
||||||
} else {
|
} else {
|
||||||
// viewing master page - need to dedupe against all screens
|
// viewing master page - need to dedupe against all screens
|
||||||
for (let screen of $store.screens) {
|
for (let screen of $allScreens) {
|
||||||
lookForDuplicate(screen.props)
|
lookForDuplicate(screen.props)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { params, leftover, goto } from "@sveltech/routify"
|
import { params, leftover, goto } from "@sveltech/routify"
|
||||||
import { store } from "builderStore"
|
import { store, allScreens } from "builderStore"
|
||||||
|
|
||||||
// Get any leftover params not caught by Routifys params store.
|
// Get any leftover params not caught by Routifys params store.
|
||||||
const componentIds = $leftover.split("/").filter(id => id !== "")
|
const componentIds = $leftover.split("/").filter(id => id !== "")
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
if ($params.screen !== "page-layout") {
|
if ($params.screen !== "page-layout") {
|
||||||
const currentScreenName = decodeURI($params.screen)
|
const currentScreenName = decodeURI($params.screen)
|
||||||
const validScreen =
|
const validScreen =
|
||||||
$store.screens.findIndex(
|
$allScreens.findIndex(
|
||||||
screen => screen.props._instanceName === currentScreenName
|
screen => screen.props._instanceName === currentScreenName
|
||||||
) !== -1
|
) !== -1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue