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
chore(examples): add routing to e-commerce demo #3921
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploy preview for instantsearchjs ready! Built with commit e547b02 |
We should set up netlify so |
a32f7b6
to
7bbd702
Compare
Netlify now correctly redirects, but the urls for JS & CSS are wrong (relative, instead of relative towards root). Solution might be a base tag, but that might break the urls we create with createURL if those are relative too |
Haroenv
approved these changes
Jul 10, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Description
This is my take at adding a routing system to the e-commerce demo.
This is definitely not easy to implement and we probably have improvements to do inside the library.
Implementation
I based the implementation on the SEO-friendly guide.
The routing values read in the URL might lead to a wrong UI state. I added fallback strategies to overcome that.
SortBy
: when we detect that thesortBy
value in the URL is not valid, we don't accept the value and fallback toundefined
. Otherwise, InstantSearch tries to target the invalid index and throws.HitsPerPage
: we fallback toundefined
if it's not listed in the items.RatingMenu
: we fallback toundefined
if it's not listed in the items.RangeSlider
: there's no easy way to know if we're out of range. It could be possible to access it viafacets_stats
inside the library but not with the public API.This fallback behaviors could be implemented in the library routing system.
Preview
See preview →