diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 61f816196e..1bd86480a4 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -26,7 +26,9 @@ export const currentScreens = derived(store, $store => { if (currentScreens == null) { return [] } - return Array.isArray(currentScreens) ? currentScreens : Object.values(currentScreens) + return Array.isArray(currentScreens) + ? currentScreens + : Object.values(currentScreens) }) export const initialise = async () => { diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index d06ff3744c..ee0c98ed8d 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -1,15 +1,24 @@ import { get, writable } from "svelte/store" -import {cloneDeep} from "lodash/fp" -import { createProps, getBuiltin, makePropsSafe } from "components/userInterface/pagesParsing/createProps" +import { cloneDeep } from "lodash/fp" +import { + createProps, + getBuiltin, + makePropsSafe, +} from "components/userInterface/pagesParsing/createProps" import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents" -import {allScreens, backendUiStore } from "builderStore" +import { allScreens, backendUiStore } from "builderStore" import { generate_screen_css } from "../generate_css" import { fetchComponentLibDefinitions } from "../loadComponentLibraries" import api from "../api" import { DEFAULT_PAGES_OBJECT } from "../../constants" import getNewComponentName from "../getNewComponentName" import analytics from "analytics" -import { findChildComponentType, generateNewIdsForComponent, getComponentDefinition, getParent } from "../storeUtils" +import { + findChildComponentType, + generateNewIdsForComponent, + getComponentDefinition, + getParent, +} from "../storeUtils" const INITIAL_FRONTEND_STATE = { apps: [], @@ -165,7 +174,9 @@ export const getFrontendStore = () => { const json = await response.json() screen._rev = json.rev screen._id = json.id - const foundScreen = currentPageScreens.findIndex(el => el._id === screen._id) + const foundScreen = currentPageScreens.findIndex( + el => el._id === screen._id + ) if (currentPageScreens !== -1) { currentPageScreens.splice(foundScreen, 1) } @@ -318,14 +329,11 @@ export const getFrontendStore = () => { const instanceId = get(backendUiStore).selectedDatabase._id const instanceName = getNewComponentName(component, state) - const newComponent = createProps( - component, - { - ...presetProps, - _instanceId: instanceId, - _instanceName: instanceName, - } - ) + const newComponent = createProps(component, { + ...presetProps, + _instanceId: instanceId, + _instanceName: instanceName, + }) const currentComponent = state.components[state.currentComponentInfo._component] diff --git a/packages/builder/src/builderStore/storeUtils.js b/packages/builder/src/builderStore/storeUtils.js index 69050e1b87..97b780de69 100644 --- a/packages/builder/src/builderStore/storeUtils.js +++ b/packages/builder/src/builderStore/storeUtils.js @@ -36,7 +36,11 @@ export const walkProps = (props, action, cancelToken = null) => { } } -export const generateNewIdsForComponent = (component, state, changeName = true) => +export const generateNewIdsForComponent = ( + component, + state, + changeName = true +) => walkProps(component, prop => { prop._id = uuid() if (changeName) prop._instanceName = getNewComponentName(prop, state) diff --git a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte index 8d119e8ec3..999014f0cd 100644 --- a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte @@ -99,9 +99,7 @@