Skip to content

Commit

Permalink
fix: only skip all initial render when network-only
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-min committed Jun 1, 2024
1 parent 0035cdc commit f26a8f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class {
const ready = readyLookup[this.id];
if (ready) {
// Hydration takes a double render pass, we avoid doing a new query until that's done.
let skipQueries = 2;
let skipQueries = input.requestPolicy === "network-only" ? 2 : 1;
const onRender = () => {
this.shouldQuery = false;
if (!--skipQueries) {
Expand Down Expand Up @@ -90,11 +90,11 @@ class {
requestPolicy: this.input.requestPolicy,
...options,
}),
subscribe(({ data, error }) => {
subscribe(({ data, error, stale }) => {
this.stopTimeout();
this.state.data = data;
this.state.error = error;
this.state.fetching = false;
this.state.fetching = !!stale;
})
).unsubscribe;
}
Expand Down
1 change: 1 addition & 0 deletions src/node_modules/@internal/gql-query/node.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static function errorToJSON() {
<gql-query-client
key="gqlc"
name=input.name
requestPolicy=input.requestPolicy
data=data
error=error
opKey=operation.key
Expand Down

0 comments on commit f26a8f5

Please sign in to comment.