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
refactor(web): search box #7397
Conversation
Deploying with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should return all of these results in a single request.
8c9bea0
to
60c025e
Compare
Thank you for picking this up. I agree with Jason, because it allow us to only fetch the data we need instead of having to update all suggestions. If we switch to managing filters and suggestions in each component instead of in I've pushed some changed that do this for the location filters and also fix #7297. Let me know what you think and feel free to make changes or revert. |
$: countryFilter = filter.country; | ||
$: stateFilter = filter.state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent unneeded updates when filter
is reassigned, but the values of country
or state
haven't actually changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this prevents this? From my understanding countryFilter
updates whenever filter.country
updates, so updateStates
will update whenever filter.country
changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will prevent updating like shown in this demo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. TIL!
Thanks, I like this approach much more! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving these changes!
web/src/lib/components/shared-components/search-bar/search-filter-box.svelte
Outdated
Show resolved
Hide resolved
$: updateMakes(modelFilter); | ||
$: updateModels(makeFilter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have to be updated when #7382 is merged since it's calling an async
function without error handling. I see the same in other files below
TheGET /search/suggestions
endpoint has been updated and returns now an object of all suggestions. As a result, theSearchSuggestionsType
has been removed.