Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Remove handled updates from the updates list (#1251)
Oleg Isonen6f6a57c0e1e8
diff --git a/apps/builder/app/builder/features/settings-panel/use-settings-logic.ts b/apps/builder/app/builder/features/settings-panel/use-settings-logic.tsindex 759a44c294..1e37814a12 100644--- a/apps/builder/app/builder/features/settings-panel/use-settings-logic.ts+++ b/apps/builder/app/builder/features/settings-panel/use-settings-logic.ts@@ -32,6 +32,19 @@ export const useSettingsLogic = () => {updates.current.push({ operation: "set", property: "label", value });};+ // Gets updates by property and removes them from the list+ const popUpdates = (property: Setting) => {+ const remainingUpdates: Array<Operation> = [];+ const searchedUpdates: Array<Operation> = [];+ for (const update of updates.current) {+ const array =+ update.property === property ? searchedUpdates : remainingUpdates;+ array.push(update);+ }+ updates.current = remainingUpdates;+ return searchedUpdates;+ };+const updateLabel = useCallback(() => {const selectedInstance = selectedInstanceStore.get();if (selectedInstance === undefined) {@@ -42,7 +55,8 @@ export const useSettingsLogic = () => {if (instance === undefined) {return;}- for (const update of updates.current) {+ const labelUpdates = popUpdates("label");+ for (const update of labelUpdates) {if (update.operation === "delete") {delete instance.label;continue;