Skip to content

Commit

Permalink
track false fetching state when loading pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Nov 10, 2022
1 parent cf4212a commit 298ce49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export function cursorHandlers<_Data extends GraphQLObject, _Input>({
variables: loadVariables,
applyUpdates: true,
})

// we're not loading any more
setFetching(false)
}

return {
Expand Down Expand Up @@ -222,6 +225,9 @@ export function cursorHandlers<_Data extends GraphQLObject, _Input>({
// keep the page info store up to date
pageInfo.set(extractPageInfo(result.data, artifact.refetch!.path))

// we're not loading any more
setFetching(false)

return {
data: result.data,
variables: queryVariables as _Input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export function offsetHandlers<_Data extends GraphQLObject, _Input>({
// add the page size to the offset so we load the next page next time
const pageSize = queryVariables.limit || artifact.refetch!.pageSize
currentOffset = offset + pageSize

// we're not loading any more
setFetching(false)
},
async fetch(
args?: QueryStoreFetchParams<_Data, _Input>
Expand Down Expand Up @@ -128,6 +131,9 @@ export function offsetHandlers<_Data extends GraphQLObject, _Input>({
variables: queryVariables as _Input,
})

// we're not loading any more
setFetching(false)

return {
data: result.data,
variables: queryVariables as _Input,
Expand Down

0 comments on commit 298ce49

Please sign in to comment.