fix(webapp): customer/vendor select should update deps

This commit is contained in:
Ahmed Bouhuolia
2023-06-22 22:07:39 +02:00
parent 4b95c19d3e
commit 5f191cf335
18 changed files with 56 additions and 26 deletions

View File

@@ -140,7 +140,8 @@ function ExpenseFormCustomerSelect() {
labelInfo={<Hint />}
inline={true}
name={'customer_id'}
customers={customers}
fastField={true}
shouldUpdateDeps={{ items: customers }}
shouldUpdate={customersFieldShouldUpdate}
>
<CustomersSelect
@@ -149,6 +150,9 @@ function ExpenseFormCustomerSelect() {
placeholder={<T id={'select_customer_account'} />}
allowCreate={true}
popoverFill={true}
fastField={true}
shouldUpdateDeps={{ items: customers }}
shouldUpdate={customersFieldShouldUpdate}
/>
</FormGroup>
);

View File

@@ -104,7 +104,7 @@ export const transformToEditForm = (
*/
export const customersFieldShouldUpdate = (newProps, oldProps) => {
return (
newProps.customers !== oldProps.customers ||
newProps.shouldUpdateDeps.items !== oldProps.shouldUpdateDeps.items ||
defaultFastFieldShouldUpdate(newProps, oldProps)
);
};