fix(ui): fixed many bugs in the WhereBuilder relationship select menu (#10553)

Following https://github.com/payloadcms/payload/pull/10551, I found and
fixed a handful more bugs:

- When writing to the input, the results that were already there were
not cleaned, causing incorrect results to appear.
- the scroll was causing an infinite loop that showed repeated elements
- optimization: only the required field is selected (not required)
- refs are set to the initial value to avoid a state where nothing can
be searched
This commit is contained in:
Germán Jabloñski
2025-01-20 16:14:49 -03:00
committed by GitHub
parent 2d70269c56
commit 56667cdc8d
7 changed files with 125 additions and 18 deletions

View File

@@ -27,6 +27,7 @@ export interface Config {
geo: Geo;
'disable-duplicate': DisableDuplicate;
'base-list-filters': BaseListFilter;
with300documents: With300Document;
'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration;
@@ -49,6 +50,7 @@ export interface Config {
geo: GeoSelect<false> | GeoSelect<true>;
'disable-duplicate': DisableDuplicateSelect<false> | DisableDuplicateSelect<true>;
'base-list-filters': BaseListFiltersSelect<false> | BaseListFiltersSelect<true>;
with300documents: With300DocumentsSelect<false> | With300DocumentsSelect<true>;
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
@@ -374,6 +376,17 @@ export interface BaseListFilter {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "with300documents".
*/
export interface With300Document {
id: string;
text?: string | null;
selfRelation?: (string | null) | With300Document;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents".
@@ -444,6 +457,10 @@ export interface PayloadLockedDocument {
| ({
relationTo: 'base-list-filters';
value: string | BaseListFilter;
} | null)
| ({
relationTo: 'with300documents';
value: string | With300Document;
} | null);
globalSlug?: string | null;
user: {
@@ -734,6 +751,16 @@ export interface BaseListFiltersSelect<T extends boolean = true> {
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "with300documents_select".
*/
export interface With300DocumentsSelect<T extends boolean = true> {
text?: T;
selfRelation?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents_select".