mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 14:30:29 +03:00
Use proper deep comparison for hasChanged
This commit is contained in:
parent
cfee62ffe6
commit
4c5acc1940
1 changed files with 2 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import React, {
|
|||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { deepCompare } from 'matrix-js-sdk/lib/utils';
|
||||
import { ExtendedProfile } from '../../../../hooks/useExtendedProfile';
|
||||
|
||||
type ExtendedProfileKeys = keyof {
|
||||
|
|
@ -71,8 +72,7 @@ export function ProfileFieldContext<C>({
|
|||
() =>
|
||||
Object.entries(fields).find(
|
||||
([key, value]) =>
|
||||
// this is a hack but ExtendedProfile is always valid JSON anyway
|
||||
JSON.stringify(fieldDefaults[key as keyof ExtendedProfile]) !== JSON.stringify(value)
|
||||
deepCompare(fieldDefaults[key as keyof ExtendedProfile], value)
|
||||
) !== undefined,
|
||||
[fields, fieldDefaults]
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue