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
Is there a way to reload/refresh? #26
Comments
Hello @fbertuzzi, The solution lies in the publisher you return from your Queryable type. For example, turn the Darwin notifications into a publisher that you use to restart the ValueObservation publisher. And this now turns into a question about Combine more than about GRDBQuery ;-) You should end up with something akin to: darwinNotificationPublisher
.map { _ in /* some ValueObservation publisher */ }
.switchToLatest() |
Hey @groue, Thank you for the super fast reply! |
I just happened to open the lid of the computer, and there you were ;-)
You have nothing more to do: the ValueObservation will do its usual job, which is to publish the current (i.e. on disk) database value on subscription, and then wait for modifications performed in the main process. There is no cached stuff or things like that. It's really "just" a Combine puzzle. |
I guess I'm pretty fortunate then!
Okay thats good! Shouldn't be that difficult then. |
You're welcome :-) Happy GRDB! |
Hey,
I'm currently trying to reload a
@Query
as my database is changed on another Process (NotificationService Extension to be exact).I'm using a DarwinNotificationCenter as described here to notify my view.
The problem that I have now, is that I can't reload the
@Query
at least I don't know how to do it.As it's not a State variable I cannot modify it. Is there maybe a builtin way in
@Query
or GRDB itself, which I don't know of to trigger a refresh?The text was updated successfully, but these errors were encountered: