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

Browser back / router.back clears query. #57

Closed
bootsmann1995 opened this issue Jun 17, 2022 · 5 comments
Closed

Browser back / router.back clears query. #57

bootsmann1995 opened this issue Jun 17, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@bootsmann1995
Copy link

bootsmann1995 commented Jun 17, 2022

Version

@nuxtjs/algolia: v0.9.2
nuxt: v3.0.0-rc.4

Reproduction Link

https://stackblitz.com/edit/nuxt-starter-9hjp9u?file=pages/index/index.page.ts

Steps to reproduce

filter twice -> go to page via ais-hits / nuxt-link (/about), use browser back. And then try to click back again.

What is Expected?

its expected it saves my query.

What is actually happening?

its clearing query. But only on first back.

heres an exsample from a productions site: https://majestic-piroshki-eafaa8.netlify.app/test-brugte-biler/

Other

when using this in app.router.options.ts

	parseQuery(query) {
		return qs.parse(query);
	},
	stringifyQuery(query) {
		const result = qs.stringify(query);

		return result ? `?${result}` : "";
	}, 

Nuxt gives this error:
image

@bootsmann1995 bootsmann1995 added the bug Something isn't working label Jun 17, 2022
@Baroshem
Copy link
Collaborator

Hey @bootsmann1995

First of all, really nice website! I am glad that you are using Nuxt Algolia module.

Thanks for raising this issue. I will try to debug it on my side and see if I can fix it :)

@Baroshem
Copy link
Collaborator

Hey @bootsmann1995

I did some debugging and I think that this kind of functionality (storing the result of the query) can be easily done by using the local/session storage and it should not be a part of the module.

I could put it as a part of the module but it wont be needed for all use cases. And considering how easy it can be to use storage to store the search result, I would recommend to go with that solution :)

Let me know if you need any help with that :)

@bootsmann1995
Copy link
Author

bootsmann1995 commented Jun 20, 2022

Hey @Baroshem , thanks a lot! :)

Great, with the quick answer!. It could be nice to get an exsample on this solution.

@bootsmann1995
Copy link
Author

@Baroshem if you saw the reproduction. It is a combination of the vue-instantsearch and nuxt/algolia. and if it makes it easier you can provide the solution inside the reproduction.

@Baroshem
Copy link
Collaborator

@bootsmann1995 AFAIK the issue has been resolved another way.

I will keep this issue open so that you can link to it with your explanation of the fix :)

@Baroshem Baroshem closed this as completed Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants