Using Qlik Sense 2.2 as part of a single page react/redux application. I need to use the getList method to get the current state of selections within a Qlik Sense app. I have a react view that calls this:
So this seems to subscribe to all selection events asynchronously and runs my callback function whenever the state changes in the qlik application. Works well and serves my purposes.
I then need to destroy my view when the user moves to another part of my application and along with it any of these async callbacks, which seems to be the job of destroySessionObject. It is documented as being able to:
destroy a Qlik Sense session object created with createGenericObject or any of createCube,createList or getList methods.
So just before I destroy my view I call this:
app.destroySessionObject(variable) // variable that is assigned to the app.getList I invoked earlier.
Unfortunately, there is something still subscribed to qlik sense selection events for this app and it is invoking my callback function resulting in errors and possible unintentional side effects. If I pass it the 'SelectionObject' string nothing really seems to happen and it returns and object with some undocumented methods:
If I pass it the variable I get the following error:
Well at the moment I'm effectively only using Qlik to bring in visualisations (more or less complete worksheets) using the getObject method. I needed to use those other methods, such as getList and clearAll, in order to reimplement the CurrentSelection bar as a react component. The existing one provided by Qlik breaks if you have more than one app open at the same time within your active view.
So far I've learned that I cannot haphazardly open and close websocket connections every time the user changes views especially if the user expects to be able to navigate back to a previous view quickly. So I've created a react component to act as container for sets of views that maintain that connection. One part of my application with four distinct screens requires three simultaneous app connections to avoid everything breaking. Consequently, the CurrentSelections bar breaks when the user navigates to this part of my application. I just cobbled together an almost identical one in terms of look and functionality minus the search feature that I didn't look too much into.
I will probably look at pulling in data directly from Qlik at some point to build some D3/leafet stuff as React components, but you are right that when it comes to Qlik stuff using a redux store might be overkill as Qlik is quite possessive about managing its state. I will likely be using my redux store for other things that don't directly involve Qlik. As of right now its a React + React Router application.
Interesting, we are also building a React + React Router app ontop of the Engine API and has been going back and forth if we should let Redux handle the data for us in addition to the UI state.
We aren't completely sold yet, instead we created like you a wrapper component that constructed the hypercubes and then passed the data down into our charting components. Worked ok so far but then again it's a small app