Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix: RecipientSelector to preserve filtered-out selected options (#4443)
teoee538b9542cb
diff --git a/js/app/packages/core/component/RecipientSelector.tsx b/js/app/packages/core/component/RecipientSelector.tsxindex bc213d4845..a761338ce3 100644--- a/js/app/packages/core/component/RecipientSelector.tsx+++ b/js/app/packages/core/component/RecipientSelector.tsx@@ -529,6 +529,26 @@ export function RecipientSelector<K extends CombinedRecipientKind>(return allOptions as CombinedRecipientItem<K>[];});+ const visibleOptionKeys = createMemo(+ () =>+ new Set(+ (options() as CombinedRecipientItem[]).map(getRecipientOptionValue)+ )+ );++ // Kobalte resolves selected values against the `options` prop+ // (getOptionsFromValues) and silently drops any selection it can't find+ // there, so selected options that the search filtered out must stay in the+ // collection. `defaultFilter` keeps them hidden from the dropdown.+ const optionsWithSelected = createMemo(() => {+ const visible = options() as CombinedRecipientItem[];+ const keys = visibleOptionKeys();+ const hiddenSelected = (+ props.selectedOptions as CombinedRecipientItem[]+ ).filter((option) => !keys.has(getRecipientOptionValue(option)));+ return [...visible, ...hiddenSelected];+ });+const [scrollToItem, setScrollToItem] = createSignal<(key: string) => void>(() => {});@@ -559,12 +579,14 @@ export function RecipientSelector<K extends CombinedRecipientKind>(onOpenChange={setIsOpen}disabled={props.disabled}validationState={invalid() ? 'invalid' : 'valid'}- options={options() as CombinedRecipientItem[]}+ options={optionsWithSelected()}optionLabel={getRecipientOptionLabel}optionValue={getRecipientOptionValue}optionTextValue={getRecipientOptionTextValue}optionDisabled={getOptionDisabled}- defaultFilter={() => true}+ defaultFilter={(option) =>+ visibleOptionKeys().has(getRecipientOptionValue(option))+ }value={props.selectedOptions as CombinedRecipientItem[]}onChange={debouncedHandleChange}onInputChange={onInputChange}