From bf915fd742a1ed05982cb6c035782879c3f6ba17 Mon Sep 17 00:00:00 2001 From: Julien Pardons Date: Fri, 30 Jul 2021 14:39:44 +0200 Subject: [PATCH 1/2] Fetch original value from options props when fetchOptions is used on created --- src/components/TRichSelect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TRichSelect.ts b/src/components/TRichSelect.ts index 3efe038..9d345df 100644 --- a/src/components/TRichSelect.ts +++ b/src/components/TRichSelect.ts @@ -364,7 +364,7 @@ const TRichSelect = MultipleInput.extend({ // fetched with the `fetchOptions` method. Since those can change, we // also need to check the `selectedOptions` array that contains the // already selected ones. - return [...this.filteredflattenedOptions, ...this.selectedOptions] + return [...this.filteredflattenedOptions, ...this.selectedOptions, ...this.options] .find((option) => this.optionHasValue(option, value)); } From 35a283547530d924048f72ee198a594e1e614902 Mon Sep 17 00:00:00 2001 From: Julien Pardons Date: Fri, 30 Jul 2021 15:25:39 +0200 Subject: [PATCH 2/2] Use flattened options instead of filtered --- src/components/TRichSelect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TRichSelect.ts b/src/components/TRichSelect.ts index 9d345df..4a2ee91 100644 --- a/src/components/TRichSelect.ts +++ b/src/components/TRichSelect.ts @@ -364,7 +364,7 @@ const TRichSelect = MultipleInput.extend({ // fetched with the `fetchOptions` method. Since those can change, we // also need to check the `selectedOptions` array that contains the // already selected ones. - return [...this.filteredflattenedOptions, ...this.selectedOptions, ...this.options] + return [...this.flattenedOptions, ...this.selectedOptions] .find((option) => this.optionHasValue(option, value)); }