facebook / facebook/relay

refetch don't call onComplete callback when fetchPolicy set to store-and-network only at first time.

Open
#3,968 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Hello. I have an issue when using refetch method of `usePaginationFragment` hook with fetchPolicy as `store-and-network`.
with fetchPolicy of `store-and-network`, refetch won't call its onComplete callback **only at first time**.

With other fetch policy option or try to refetch again, it calls onComplete every time.

```typescript
refetchAdvertisementList(variable, {
fetchPolicy: 'store-and-network',

onComplete: () => {
console.log('dispose'); // this won't happen only at first time.
dispose();
},
});
```

Here's my event log and I can't find any difference between success case and failure case in Relay event logger.(First section is Failure, and second section is success)
![image](https://user-images.githubusercontent.com/29659112/172983378-4a1c93ad-9412-43b5-9413-85d86cb1f59e.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.