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

persist should return disposer #20

Open
agilgur5 opened this issue Nov 18, 2019 · 0 comments
Open

persist should return disposer #20

agilgur5 opened this issue Nov 18, 2019 · 0 comments
Labels
kind: feature New feature or request

Comments

@agilgur5
Copy link
Owner

agilgur5 commented Nov 18, 2019

This is part feature, as it introduces new functionality, and part bug, as really it should have always returned a disposer to begin with.

Without a disposer there is, well, no way to dispose of the onSnapshot listener, and therefore no way to pause / stop persistence. A disposer is returned from onSnapshot and should be returned by persist. As it currently returns a Promise, it should be within that Promise.

While the current Promise returns the snapshot of persisted data, that's actually undocumented behavior as you can get the snapshot directly from the store anyway. It's not particularly useful behavior as a result; when I originally created this, I just figured I'd return something rather than nothing/void.
So while this would be breaking, I think it should be ok to change without a major as I don't believe anyone's using that functionality (though no one's requested this functionality either, as it's a fairly uncommon need).
As this is part feature and part breaking change, leaning toward releasing this change as a minor (and breaking changes in minors are ok in semver for 0.x releases) rather than a patch.

@agilgur5 agilgur5 added kind: feature New feature or request and removed feature labels Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant