Skip to content

Commit c75cceb

Browse files
committed
refactor(pr-comments): acconting for regression
1 parent 286db6c commit c75cceb

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

packages/fetchye/src/queryHelpers.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,18 @@
1717
export const isLoading = ({
1818
loading, data, options, error, refs,
1919
}) => {
20-
// if defer is true
21-
if (options.defer) {
22-
// isLoading should be false
23-
return false;
24-
}
25-
2620
// If loading from cache is true
2721
if (loading) {
2822
// isLoading should be true
2923
return true;
3024
}
3125

32-
// Here to mimic what happens in the useEffect
33-
if (
34-
(!data && !error)
35-
|| (refs.forceInitialFetch === true)
36-
) {
26+
// will fetch if no data and no error
27+
// will fetch if forceInitialFetch is true
28+
const willFetchIfNotDefered = (!data && !error)
29+
|| (refs.forceInitialFetch === true);
30+
31+
if (willFetchIfNotDefered && !options.defer) {
3732
return true;
3833
}
3934

0 commit comments

Comments
 (0)