Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Ability to persist a widget #14

Closed
mthuret opened this issue Apr 11, 2017 · 5 comments
Closed

Ability to persist a widget #14

mthuret opened this issue Apr 11, 2017 · 5 comments

Comments

@mthuret
Copy link
Contributor

mthuret commented Apr 11, 2017

Use case

You have a mobile app using React Native and you want to use a modal to display some filters. When this modal is closed, the widgets that sets the refinements are unmounted, therefore, they're not in the state anymore. see: algolia/instantsearch#2069

Need

Being able to say that a widget is persistent. That way its state will remain and can still be applied if a virtual widget is present.

Proposal

Add a prop isPersistent, that if present will indicate that nothing should happen inside the clean function.

@mthuret
Copy link
Contributor Author

mthuret commented Apr 24, 2017

Another possibility here is to actually use another <InstantSearch> instance inside the modal, and forward the state to the main one. That way, virtual widgets does apply.

@ylac
Copy link

ylac commented Apr 25, 2017

Yes this would be very helpful.

@mclapa
Copy link

mclapa commented Jun 23, 2017

I also see this as a problem as I have it set up in the header of my page, and every navigation between pages causes another POST

In turn I have about 2200 requests while dev (out of 100k) which will quickly fill up when it goes live.

I'm thinking about creating a component with it at the top-most parent and passing it down, perhaps it won't re-render when the component itself gets re-rendered, but we'll see how it goes

@catamphetamine
Copy link

@mclapa Thread hijacker, no thread hijacking!
We're also having this issue when using filters inside react-modal which unmounts contents on close.
The virtual widgets workaround would most likely work but since we're not constrained by mobile SDK here we decided to try the quick old-school pure CSS modal approach instead.

@mthuret
Copy link
Contributor Author

mthuret commented Oct 9, 2017

I'm closing this as for now I don't have a really good API proposal that would fix everything. Our getting started explains how to get along this, feel free to comment/open a new issue if necessary or if you have a proposal :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants