feat(ui): update RelationshipFilter if only filterOptions are changed (#11985)
### What?
Extends trigger of a reload of the fields for RelationshipFilter to
include `filterOptions`.
### Why?
If you have two or more relationship fields that have a relation to the
same collection, the options of the filter will not update.
### How
By extending dependencies of `useEffect`
### Code setup:
```
{
name: 'media',
type: 'relationship',
relationTo: 'media',
filterOptions: () => {
return {
id: { in: ['67efaee24648d01dffceecf9'] },
}
}
},
{
name: 'media2',
type: 'relationship',
relationTo: 'media',
filterOptions: () => {
return {
id: { in: ['67efafb04648d01dffceed75'] },
}
}
},
```
### Before:
https://github.com/user-attachments/assets/bdc5135b-3afa-48df-98fe-6a9153dd7710
### After:
https://github.com/user-attachments/assets/d71a7558-6413-4c97-9b0b-678cf3b011d0
-->
This commit is contained in:
@@ -324,7 +324,7 @@ export const RelationshipFilter: React.FC<Props> = (props) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
}, [i18n, relationTo, debouncedSearch])
|
||||
}, [i18n, relationTo, debouncedSearch, filterOptions])
|
||||
|
||||
/**
|
||||
* Load any other options that might exist in the value that were not loaded already
|
||||
|
||||
Reference in New Issue
Block a user