Closed k-ode closed 1 year ago
New helper functions that gives a you default run action: createQueryWithRun, createMutationWithRun.
createQueryWithRun
createMutationWithRun
export const ChatQuery = createQueryWithRun('ChatQuery', { request: types.model({ id: types.string }), pagination: types.model({ offset: types.number }), data: MstQueryRef(ChatModel), queryFn: api.getChat, });
Infinite queries are easier with onQueryMore. After pagination changes, queryMore will be called with the new arguments. onQueryMore is used to determine how the new data should be appended.
onQueryMore
const { data } = useQuery(ListQuery, { request: { id: 'test' }, pagination: { offset: offsetProp }, onQueryMore(data, self) { self.data?.items.push(...data.items); }, });
New helper functions that gives a you default run action:
createQueryWithRun
,createMutationWithRun
.Infinite queries are easier with
onQueryMore
. After pagination changes, queryMore will be called with the new arguments.onQueryMore
is used to determine how the new data should be appended.