From d166cbb466599afeeb48652b21ddec4a3cfc213f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 14 Oct 2022 19:45:47 +0100 Subject: [PATCH] Lint and prevent scrolling to selected component when starting dragging --- packages/builder/src/builderStore/store/frontend.js | 2 +- packages/client/src/components/Component.svelte | 6 +++++- packages/frontend-core/src/utils/utils.js | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 4122954303..848dd4405a 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -1,6 +1,6 @@ import { get, writable } from "svelte/store" import { cloneDeep } from "lodash/fp" -import { selectedScreen, selectedComponent, store } from "builderStore" +import { selectedScreen, selectedComponent } from "builderStore" import { datasources, integrations, diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 6d341b2eb8..5996b182eb 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -421,7 +421,11 @@ } const scrollIntoView = () => { - return + // Don't scroll into view if we selected this component because we were + // starting dragging on it + if (get(dndIsDragging)) { + return + } const node = document.getElementsByClassName(id)?.[0]?.children[0] if (!node) { return diff --git a/packages/frontend-core/src/utils/utils.js b/packages/frontend-core/src/utils/utils.js index ed76f13494..8aa49392fb 100644 --- a/packages/frontend-core/src/utils/utils.js +++ b/packages/frontend-core/src/utils/utils.js @@ -4,8 +4,6 @@ * @param fn the async function to run * @return {Promise} a sequential version of the function */ -import { lastIndexOf } from "lodash/array" - export const sequential = fn => { let queue = [] return async (...params) => {