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

chore(examples): add routing to e-commerce demo #3921

merged 9 commits into from Jul 11, 2019


Copy link

@francoischalifour francoischalifour commented Jul 3, 2019


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.


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 the sortBy value in the URL is not valid, we don't accept the value and fallback to undefined. Otherwise, InstantSearch tries to target the invalid index and throws.
  • HitsPerPage: we fallback to undefined if it's not listed in the items.
  • RatingMenu: we fallback to undefined 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 via facets_stats inside the library but not with the public API.

This fallback behaviors could be implemented in the library routing system.


See preview →

@francoischalifour francoischalifour requested a review from a team Jul 3, 2019
@ghost ghost requested review from eunjae-lee and yannickcr and removed request for a team Jul 3, 2019
Copy link

algobot commented Jul 3, 2019

Deploy preview for instantsearchjs ready!

Built with commit e547b02

Copy link

Haroenv commented Jul 8, 2019

We should set up netlify so /examples/*/search shows the same as examples/*

@francoischalifour francoischalifour changed the base branch from chore/examples-e-commerce-typescript to develop Jul 8, 2019
Copy link

Haroenv commented Jul 10, 2019

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

Copy link
Member Author

francoischalifour commented Jul 10, 2019

URLs now work on Netlify with:

This is ready for review.

@francoischalifour francoischalifour merged commit 9e49f32 into develop Jul 11, 2019
5 of 6 checks passed
@francoischalifour francoischalifour deleted the chore/examples-e-commerce-routing branch Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants