[FEATURE] Add event-driven refecting to `useFlowQuery`
Issue to be solved
Currently, useFlowQuery is naiive to any state changes on chain that may have affected the query result and can only refetch when manually triggered by developers or within the boundaries of React Query.
It would be extremely useful to have the ability to update UI state in response to on-chain events.
Suggest A Solution
Something along the lines of:
useFlowQuery({
...stuff,
refectchEvents: [
{
event: "A.1234.SomethingHappened"
filter: (evt) => evt.data.user === "FooBar"
}
]
})
What are you currently working on that this is blocking?
No response
@bluesign I'd be curious if you had any thoughts/other ideas around this.
I'm trying to think of ways that we can make apps more responsive and lean into event streaming better (which feels woefully underutlized right now).
@jribbink oh I was playing with this idea a little bit; ( at least similar )
I think account address(es) as dependency works here better than events. ( Event is tricky because naive approach there always leads to over subscribing, as a developer my instinct can be to subscribe to FlowToken / FungibleToken events if I have a label with user's flow balance etc ). Also on another level, even on correct usage, events feel like something still simulated when no-one is looking.