mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: check deep equality
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user