From 981b48acc0dfcfaf40fe947fec408ceecc6c6817 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Tue, 7 Apr 2026 11:53:34 +0700 Subject: [PATCH] fix: check deep equality --- .../production/recording/form/RecordingForm.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 846c6d7a..680be036 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -974,9 +974,17 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { return; } - if (next[item.id] !== item) { - next[item.id] = item; - changed = true; + const existing = next[item.id]; + if (existing !== item) { + // Check deep equality to avoid triggering state changes + // when identical data comes from different sources (e.g. initialValues vs SWR) + if ( + !existing || + JSON.stringify(existing) !== JSON.stringify(item) + ) { + next[item.id] = item; + changed = true; + } } });