taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit ec02043b325be58d8d0c5aa387cbd0f6c088701c
parent 7c2a7a42fc7166661ec2a8c3ae6245419a1ff8ee
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Wed, 15 Apr 2026 16:53:38 -0300

fix #10959

Diffstat:
Mpackages/merchant-backoffice-ui/src/Routing.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx | 28++++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/Routing.tsx b/packages/merchant-backoffice-ui/src/Routing.tsx @@ -395,7 +395,7 @@ export function Routing(_p: Props): VNode { route(`/`); }} onConfirm={() => { - route(`/`); + }} /> {/** diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx @@ -91,7 +91,8 @@ export function UpdatePage({ }: Props): VNode { const { state, config, lib } = useSessionContext(); - const [value, valueHandler] = useState<Partial<Entity>>(convert(selected)); + const initial = convert(selected) + const [value, valueHandler] = useState<Partial<Entity>>(initial); const { i18n } = useTranslationContext(); @@ -176,6 +177,8 @@ export function UpdatePage({ }; const [notification, safeFunctionHandler] = useLocalNotificationBetter(); const mfa = useChallengeHandler(); + + const cleanForm = deepEqual(result, initial); const update = safeFunctionHandler( i18n.str`update instance settings`, async ( @@ -189,7 +192,7 @@ export function UpdatePage({ } return resp; }, - hasErrors || !state.token ? undefined : [state.token, result, []], + hasErrors || cleanForm || !state.token ? undefined : [state.token, result, []], ); update.onSuccess = onConfirm; update.onFail = (fail) => { @@ -314,3 +317,24 @@ export function UpdatePage({ </div> ); } + +function deepEqual(obj1: unknown, obj2: unknown): boolean { + if (obj1 === obj2) return true; + + if ( + typeof obj1 !== 'object' || obj1 === null || + typeof obj2 !== 'object' || obj2 === null + ) { + return false; + } + + const keys1 = Object.keys(obj1 as object); + const keys2 = Object.keys(obj2 as object); + + if (keys1.length !== keys2.length) return false; + + return keys1.every(key => + Object.prototype.hasOwnProperty.call(obj2, key) && + deepEqual((obj1 as any)[key], (obj2 as any)[key]) + ); +}