fix(ui): handles falsey relationship options on reset (#8095)
This commit is contained in:
@@ -29,15 +29,18 @@ const sortOptions = (options: Option[]): Option[] =>
|
||||
export const optionsReducer = (state: OptionGroup[], action: Action): OptionGroup[] => {
|
||||
switch (action.type) {
|
||||
case 'CLEAR': {
|
||||
const exemptValues = Array.isArray(action.exemptValues)
|
||||
? action.exemptValues
|
||||
: [action.exemptValues]
|
||||
const exemptValues = action.exemptValues
|
||||
? Array.isArray(action.exemptValues)
|
||||
? action.exemptValues
|
||||
: [action.exemptValues]
|
||||
: []
|
||||
|
||||
const clearedStateWithExemptValues = state.filter((optionGroup) => {
|
||||
const clearedOptions = optionGroup.options.filter((option) => {
|
||||
if (exemptValues) {
|
||||
return exemptValues.some((exemptValue) => {
|
||||
return (
|
||||
exemptValue &&
|
||||
option.value === (typeof exemptValue === 'object' ? exemptValue.value : exemptValue)
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user