From b752357224678e6422f22e59045d72d614a8da26 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Thu, 4 Apr 2024 09:01:26 +0300 Subject: [PATCH] Fix profile settings Is Floating PanelVisible --- .../ProfileSettings/ProfileSettings.tsx | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/ProfileSettings/ProfileSettings.tsx b/src/components/ProfileSettings/ProfileSettings.tsx index 1891ddeb..b03b6aa8 100644 --- a/src/components/ProfileSettings/ProfileSettings.tsx +++ b/src/components/ProfileSettings/ProfileSettings.tsx @@ -1,7 +1,18 @@ import { createFileUploader } from '@solid-primitives/upload' import { clsx } from 'clsx' import deepEqual from 'fast-deep-equal' -import { For, Match, Show, Switch, createEffect, createSignal, lazy, onCleanup, onMount } from 'solid-js' +import { + For, + Match, + Show, + Switch, + createEffect, + createSignal, + lazy, + onCleanup, + onMount, + on +} from "solid-js"; import { createStore } from 'solid-js/store' import { useConfirm } from '../../context/confirm' @@ -156,12 +167,15 @@ export const ProfileSettings = () => { onCleanup(() => window.removeEventListener('beforeunload', handleBeforeUnload)) }) - createEffect(() => { - if (!deepEqual(form, prevForm)) { - setIsFloatingPanelVisible(true) - } - }) - + createEffect( + on( + () => deepEqual(form, prevForm), + () => { + setIsFloatingPanelVisible(!deepEqual(form, prevForm)) + }, + { defer: true } + ), + ) const handleDeleteSocialLink = (link) => { updateFormField('links', link, true) }