-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add SQLite, account creation, and account fetching #16
Conversation
const createAccount = facade.createAccount.useMutation({ | ||
onSuccess: () => { | ||
qc.invalidateQueries({ | ||
queryKey: ['getAccounts'] | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: IIRC, it's possible to set a default for this with React Query. I'd recommend busting the whole cache on mutation. IMO, being overly aggressive with cache busting after a mutation is usually the way to go; especially for stuff like accounts that will be on-device, so the request doesn't even need to go over the wire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the node app, we handle this at the trpc-react
level: https://github.com/iron-fish/ironfish-node-app/blob/9712ebf2cd64507b42b8a055ab9efebc9a808f6d/renderer/providers/TRPCProvider.tsx#L14
So I think we'd need to add something to data-facade
to allow for this? We can pass defaultOptions to the QueryClient to set onSuccess
by default, but it would get clobbered if we wanted to set onSuccess
on mutations explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to kick this down the road and add a ticket in Linear for it: https://linear.app/if-labs/issue/IFL-2522/invalidate-react-query-query-cache-on-all-mutations
Changes
DatabaseLoader
component to_layout.tsx
that runs an initialization migration (like in the node app)data-facade
to pass through mutation options to allow clearing the query cache after a mutationdemoHandlers
(I'm down to restructure these to something different)Fixes IFL-2422