Back to search - routing URLS

instantsearch

#1

Hi

in our instantSearch we had routing: true which worked fine for chrome and firefox but not safari. We have tried using the routing URLS from the API docs and this almost works (See below)

routing: {
stateMapping: {
stateToRoute(uiState) {
return {
q: uiState.query,
country:
(uiState.refinementList &&
uiState.refinementList.field_country &&
uiState.refinementList.field_country.join(’~’)),
continent:
(uiState.refinementList &&
uiState.refinementList.field_continent &&
uiState.refinementList.field_continent.join(’~’)),
collection:
(uiState.refinementList &&
uiState.refinementList.field_collection &&
uiState.refinementList.field_collection.join(’~’)),
artist:
(uiState.refinementList &&
uiState.refinementList.field_artist &&
uiState.refinementList.field_artist.join(’~’)),
category:
(uiState.refinementList &&
uiState.refinementList.field_category &&
uiState.refinementList.field_category.join(’~’)),
tags:
(uiState.refinementList &&
uiState.refinementList.field_tags &&
uiState.refinementList.field_tags.join(’~’)),
p: uiState.page || 1,
};
},
routeToState(routeState) {
return {
query: routeState.q,
refinementList: {
field_country: routeState.country && routeState.country.split(’~’),
field_continent: routeState.continent && routeState.continent.split(’~’),
field_collection: routeState.collection && routeState.collection.split(’~’),
field_artist: routeState.artist && routeState.artist.split(’~’),
field_category: routeState.category && routeState.category.split(’~’),
field_tags: routeState.tags && routeState.tags.split(’~’),
},
page: routeState.p,
};
}
},
},

Searching we get a url http://localhost:8180/search?q=london&continent=Europe&p=1 . If we reload this url however it changes to http://localhost:8180/london?continent=Europe&p=1 and breaks the page. Any ideas how we can resolve this?

See the text environment https://tww-371-watercolour-world.pantheonsite.io/search

Thanks

Matt