-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Hello,
We're currently using this library a project and ran into an issue where the search modal would be displayed whenever any query string was added to the URL. This was an issue as any user coming from a marketing email, or google ad would immediately have the search modal pop up.
Our current workaround has been to update the getStateFromUrl function in router.js to filter out any query parameters it shouldn't care about e.g.
export const getStateFromUrl = ({ search }) => {
let filteredQuery = {};
if (search) {
// allowedQueryParams are the only values passed back to the Algolia model
const allowedQueryParams = [
'query',
'refinementList',
'range',
'page'
];
const queryString = qs.parse(search.slice(1));
filteredQuery = Object.fromEntries(
Object.entries(queryString).filter(([key]) =>
allowedQueryParams.includes(key)
)
);
}
return filteredQuery;
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels