Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/query/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export function createQuery(instanceOptions?: Configuration): Query {
// For the refetching event, we want to immediately return if there's
// a pending resolver.
if (event === 'refetching' && value !== undefined) {
emit(key, event, value.item)
queueMicrotask(() => emit(key, event, value.item))
}

return function () {
Expand Down Expand Up @@ -426,7 +426,7 @@ export function createQuery(instanceOptions?: Configuration): Query {

// Adds the resolver to the cache.
resolversCache.set(key, { item: result, controller })
emit(key, 'refetching', result)
queueMicrotask(() => emit(key, 'refetching', result))

// The promise executor runs synchronously,
// so trigger is guaranteed to be defined here.
Expand Down