I have a svelte app and onMount function I create and open an event stream and onDestroy function I want to close the stream.
When I am on the page and I hit refresh it displays an error saying smth like faunaStream is null.
When I just leave the page, this works correctly.
And this a behavior that I am trying to debug in svelte but I also want to actually inspect the fauna streams (either using fauna js driver, either using fql in shell, or any other option available that I am not aware of)
The JavaScript driver does not provide any stream management capabilities.
When you construct a stream, you have to hold onto the returned object. If you lose the object, there is no mechanism provided to recover it, nor to provide a list of any streams that might be open.
It sounds like your app might be losing track of the stream object somehow. Or, on page refresh, perhaps onMount is not being called? The error you reported does not come from the JS driver, so I expect it comes from the Svelte middleware.
I’m not familiar with Svelte so I can’t provide any further details. Maybe someone else with Svelte experience can provide some suggestions.
I could be wrong, but is the variable you are storing the stream reference to declared outside the onMount function? If not, that could be the issue. Just a thought.