Merge pull request #14351 from strapi/relations/search-on-open

[Relations] Search on open
This commit is contained in:
Gustav Hansen 2022-09-08 11:14:33 +02:00 committed by GitHub
commit 98109250ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,10 @@ export const RelationInputWrapper = ({
searchFor(term, { idsToOmit: modifiedData?.[name]?.connect?.map((relation) => relation.id) });
};
const handleOpenSearch = () => {
searchFor('', { idsToOmit: modifiedData?.[name]?.connect?.map((relation) => relation.id) });
};
const handleSearchMore = () => {
search.fetchNextPage();
};
@ -143,7 +147,7 @@ export const RelationInputWrapper = ({
onSearch={(term) => handleSearch(term)}
onSearchNextPage={() => handleSearchMore()}
onSearchClose={() => {}}
onSearchOpen={() => {}}
onSearchOpen={handleOpenSearch}
placeholder={formatMessage(
placeholder || {
id: getTrad('relation.add'),