mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-21 14:36:31 +00:00
fix(share): the user picked to invite shows in the field before it is sent
The share dialog stored the pick as String(value) while its options are keyed by numeric user ids. CustomSelect looked the pick up with a strict comparison, found nothing and left the trigger on its placeholder, although the Invite button was already enabled and the invite went through. The phone opens the same dialog from the Mehr sheet, so it showed the same. CustomSelect now compares the held value and the option values as text, so a caller holding "5" finds the option keyed 5 and the other way round. A held null or undefined still matches nothing. onChange keeps handing back the option value unchanged. No other caller mixes the two kinds today; the place form had worked around the same trap by keying its options as strings, and its comment now says why the string stays. Tests: CustomSelect matches across both kinds and marks the pick in the list, the desktop dialog shows the picked name and clears after the invite, and the phone share sheet does the same through the real dialog. Refs #2478
This commit is contained in:
@@ -1196,9 +1196,8 @@ export default function PlaceFormModal(props: PlaceFormModalProps) {
|
||||
options={[
|
||||
{ value: '', label: t('places.noCategory') },
|
||||
...(categories || []).map(c => ({
|
||||
// form.category_id is a string; CustomSelect matches options by
|
||||
// strict equality, so the option value must be a string too —
|
||||
// otherwise the chosen category never renders in the trigger.
|
||||
// A string like form.category_id, so the picked option hands
|
||||
// back the same kind of value the form already keeps.
|
||||
value: String(c.id),
|
||||
label: c.name,
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user