Users want useMutation to work just like useQuery, not callback style like useLazyQuery.
We have been experimenting with proxy-style mutations in the past, during the early days of core v3 refactoring. Users tend to store proxy objects in states, when properties are being accessed in future renders, unexpected mutation fetches will happen, frequently so in some cases.
It is possible to allow the storage of stale accessors in states, by stripping their ability of triggering further fetches after the first fetch is happened.
- For queries and mutations, accessors are deep frozen into the respond data. That is, their ability to trigger fetches is removed after their first fetch.
- Caches are only read by accessors before their first fetch happens.
- Our current
memo of context should be scrapped, do benchmarks if we actually re-create resolver contexts every single render.
Subscriptions should not be affected, since reconnection is always allowed and should not have side effects.
Originally posted by @hyusetiawan in #1601 (reply in thread)
@vicary for both modes, where do you get the variable mutation in the button onclick?
the API is rather awkward, I am sure there is an engineering reasoning behind it, is it not possible to do:
const {login} = useMutation()
const [mutation, state] = login
so it is more consistent with the useQuery?
Users want
useMutationto work just likeuseQuery, not callback style likeuseLazyQuery.We have been experimenting with proxy-style mutations in the past, during the early days of core v3 refactoring. Users tend to store proxy objects in states, when properties are being accessed in future renders, unexpected mutation fetches will happen, frequently so in some cases.
It is possible to allow the storage of stale accessors in states, by stripping their ability of triggering further fetches after the first fetch is happened.
memoof context should be scrapped, do benchmarks if we actually re-create resolver contexts every single render.Subscriptions should not be affected, since reconnection is always allowed and should not have side effects.
Originally posted by @hyusetiawan in #1601 (reply in thread)