Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PWA): Autocomplete search functionality in Link component #2127

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

fadilsiddique
Copy link

@fadilsiddique fadilsiddique commented Aug 27, 2024

Problem

The Autocomplete search functionality in the Link component was not properly triggering API calls to frappe.desk.search.search_link when users entered search queries. This resulted in a non-responsive search experience, where users couldn't see updated options based on their input. The options were limited to 10 and if documents are more than 10 you wont be able to search the rest of the documents.

WhatsApp Image 2024-08-20 at 9 33 07 PM (2)

Solution
This PR addresses the issue by restructuring how we handle query changes in the Autocomplete component:

  1. Added an @update:query event handler to the Autocomplete component in the template.
  2. Implemented a new handleQueryUpdate function to manage query changes efficiently.
  3. Removed the problematic watcher for autocompleteRef.value?.query that wasn't reliably detecting changes.
  4. Ensured that the reloadOptions function is called with the updated query, triggering the API call to fetch new options.

Screenshot from 2024-08-28 02-09-00

https://github.com/frappe/hrms/issues/2120

@fadilsiddique
Copy link
Author

@ruchamahabal please review this PR

@ruchamahabal ruchamahabal merged commit a0ae233 into frappe:develop Aug 28, 2024
7 checks passed
ruchamahabal added a commit that referenced this pull request Aug 28, 2024
…2127

fix(PWA):  Autocomplete search functionality in Link component (backport #2127)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants