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: Search Page does not search on the backend while typing #344

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

carlosthe19916
Copy link
Member

Currently the Search Page does not search against the whole DB/Backend.

main branch:

  • the function useAllEntities fetches entities based on a filterText whose value is always empty ""
  • has a function filterEntityListByValue which is trimming the results of the backend.

After this PR:

  • the function useAllEntities fetches continuously entities based on what the user types in the Input Text
  • The function filterEntityListByValue has been removed and now we render "all" elements returned by the backend. The backend is better filtering data based on an input string so we do not need to cut/trim the original results.
  • Although we do not filter the results of the backend, now with this PR we sort the entities list. Setting on top the entities that have a better match on the title and then description as a second alternative.
  • Added a debounce to the Search Input text so we search in the backend using a delay of 500ms and avoid sending multiple requests.
  • Enhanced the ids for entities to avoid collision (while running it I randomly saw that my browser told me multiple elements had the same id, not anymore with this change)
id: `advisory-${item.uuid}`,

@carlosthe19916 carlosthe19916 changed the title Performance fix: Search Page does not search on the backend while typing Feb 10, 2025
@carlosthe19916 carlosthe19916 merged commit f4f4321 into trustification:main Feb 11, 2025
7 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 11, 2025
Copy link

Successfully created backport PR for release/0.2.z:

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.

2 participants