ApolloProvider: New waitForLoaded option
This commit is contained in:
@@ -8,8 +8,12 @@ export class ApolloProvider {
|
||||
this._collecting = false
|
||||
}
|
||||
|
||||
collect () {
|
||||
collect (options) {
|
||||
const finalOptions = Object.assign({}, {
|
||||
waitForLoaded: true,
|
||||
}, options)
|
||||
this._promises = []
|
||||
this._collectingOptions = finalOptions
|
||||
this._isCollecting = true
|
||||
return () => this._ensureReady()
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ export class DollarApollo {
|
||||
this.provider._waitFor(new Promise((resolve, reject) => {
|
||||
sub = query.subscribe({
|
||||
next: result => {
|
||||
resolve(result)
|
||||
if (!this.provider._collectingOptions.waitForLoaded || !result.loading) {
|
||||
resolve(result)
|
||||
}
|
||||
},
|
||||
error: error => {
|
||||
reject(error)
|
||||
|
||||
Reference in New Issue
Block a user