feat(conversation): #COCO-5574 remove search text after select user#984
feat(conversation): #COCO-5574 remove search text after select user#984Romu-C wants to merge 2 commits intodevelop-b2schoolfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates the conversation message recipient picker so that after selecting a recipient, the search input is cleared (and the search results are reset), aligning with ticket #COCO-5574.
Changes:
- Add a
resetSearchaction touseSearchRecipientsand exposeresetSearchValue()from the hook. - Call
resetSearchValue()after a recipient is selected inRecipientListEdit.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| conversation/frontend/src/features/message-edit/hooks/useSearchRecipients.tsx | Adds reducer action + hook API to reset search input/results. |
| conversation/frontend/src/features/message-edit/components/RecipientListEdit.tsx | Invokes the new reset function after recipient selection. |
Comments suppressed due to low confidence (1)
conversation/frontend/src/features/message-edit/hooks/useSearchRecipients.tsx:22
- The
Actionunion includes{ type: 'on' }, but the reducer has nocase 'on'and this action isn't dispatched anywhere in the codebase. This is confusing and becomes a runtime crash if it’s ever dispatched; please either remove it from the union or implement the corresponding reducer case.
type Action =
| { type: 'resetSearch' }
| { type: 'onChange'; payload: string }
| { type: 'isSearching'; payload: boolean }
| { type: 'addResult'; payload: OptionListItemType[] }
| { type: 'addApiResult'; payload: Visible[] }
| { type: 'on'; payload: Visible[] }
| { type: 'updateSearchResult'; payload: OptionListItemType[] }
| { type: 'emptyResult'; payload: OptionListItemType[] };
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
conversation/frontend/src/features/message-edit/hooks/useSearchRecipients.tsx
Show resolved
Hide resolved
| await handleSelectRecipient(recipient); | ||
| setLoadingBookmarkIndex(undefined); | ||
| resetSearchValue(); |
There was a problem hiding this comment.
handleRecipientClick updates loadingBookmarkIndex (and now resets the search) only on the success path. If handleSelectRecipient() rejects (e.g., getBookmarkById query fails), loadingBookmarkIndex will stay set and the error will be unhandled. Wrap the await in try/catch/finally so the loading state is always cleared, and decide whether resetSearchValue() should run only on success.
| await handleSelectRecipient(recipient); | |
| setLoadingBookmarkIndex(undefined); | |
| resetSearchValue(); | |
| try { | |
| await handleSelectRecipient(recipient); | |
| resetSearchValue(); | |
| } catch (error) { | |
| // eslint-disable-next-line no-console | |
| console.error('Failed to select recipient', error); | |
| } finally { | |
| setLoadingBookmarkIndex(undefined); | |
| } |
jcbe-ode
left a comment
There was a problem hiding this comment.
[low] Suis d'accord avec copilot. Voir si c'est faisale facilement, car c'est mineur.
…hRecipients.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>



Description
This PR updates the conversation message recipient picker so that after selecting a recipient, the search input is cleared (and the search results are reset), aligning with ticket #COCO-5574.
Changes:
Fixes
(Enter here Jira or Redmine ticket(s) links)
Type of change
Please check options that are relevant.
Which packages changed?
Please check the name of the package you changed
Tests
Reminder
Security flaws
Performance impacts (think bulk !)
Unit tests were replayed
Unit tests were added and/or changed
I have updated the reminder for the version including my modifications
All done ! 😃