Added RecordValue use-context-selector to settings field's logic (#5851)

In the settings part of the app, where display fields are used as in
table cell and board cards, we didn't have the new context selector
logic implemented, due to the recent performance optimization.
This commit is contained in:
Lucas Bordeau
2024-06-13 12:43:13 +02:00
committed by GitHub
parent b26fd00a40
commit 6f65fa295b
3 changed files with 119 additions and 109 deletions

View File

@ -1,6 +1,7 @@
import { useEffect } from 'react';
import { useSetRecoilState } from 'recoil';
import { useSetRecordFieldValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
type SettingsDataModelSetFieldValueEffectProps = {
@ -21,9 +22,12 @@ export const SettingsDataModelSetFieldValueEffect = ({
}),
);
const setRecordFieldValue = useSetRecordFieldValue();
useEffect(() => {
setFieldValue(value);
}, [value, setFieldValue]);
setRecordFieldValue(entityId, fieldName, value);
}, [value, setFieldValue, setRecordFieldValue, entityId, fieldName]);
return null;
};