You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to ignore the ordering of elements in an array when computing the isDirty state? I am using MUI autocomplete to allow users to select multiple values for a field and I am sorting the values for display purposes. But the value got from the BE may not be sorted. This causes some problems when you remove an element, but add it back.
For example... if the value is ["Red", "Blue", "Green"], it will be displayed in the form as "Blue", "Green", "Red". When you remove "Red", the form's isDirty state will be true. If you add the "Red" back to the list. The form's dirty state is still true becuse now the ordering will be ["Blue", "Green", "Red"]. The ordering has changed.
I want the isDirty state to be reset to "false" since the elements in the array did not change. Is this posible?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
Is there a way to ignore the ordering of elements in an array when computing the isDirty state? I am using MUI autocomplete to allow users to select multiple values for a field and I am sorting the values for display purposes. But the value got from the BE may not be sorted. This causes some problems when you remove an element, but add it back.
For example... if the value is ["Red", "Blue", "Green"], it will be displayed in the form as "Blue", "Green", "Red". When you remove "Red", the form's isDirty state will be true. If you add the "Red" back to the list. The form's dirty state is still true becuse now the ordering will be ["Blue", "Green", "Red"]. The ordering has changed.
I want the isDirty state to be reset to "false" since the elements in the array did not change. Is this posible?
Thanks
Anand
Beta Was this translation helpful? Give feedback.
All reactions