diff --git a/src/node_modules/@internal/gql-query/components/gql-query-client/index.marko b/src/node_modules/@internal/gql-query/components/gql-query-client/index.marko index dda900a..808301f 100644 --- a/src/node_modules/@internal/gql-query/components/gql-query-client/index.marko +++ b/src/node_modules/@internal/gql-query/components/gql-query-client/index.marko @@ -21,6 +21,7 @@ class { this.shouldQuery = false; if (!--skipQueries) { this.removeListener("render", onRender); + this.doQuery({ requestPolicy: "cache-first" }); } }; this.on("render", onRender); @@ -86,16 +87,20 @@ class { } this.unsubscribe = pipe( - getClient(undefined, this.input.name).query(this.input.query, this.input.variables, { - requestPolicy: this.input.requestPolicy, - ...options, - }), - subscribe(({ data, error }) => { + getClient(undefined, this.input.name).query( + this.input.query, + this.input.variables, + { + requestPolicy: this.input.requestPolicy, + ...options, + }, + ), + subscribe(({ data, error, stale }) => { this.stopTimeout(); this.state.data = data; this.state.error = error; - this.state.fetching = false; - }) + this.state.fetching = !!stale; + }), ).unsubscribe; } } @@ -105,7 +110,7 @@ class { state, (options) => { component.doQuery({ requestPolicy: "network-only", ...options }); - } + }, )/>