From 82d6c02f7b0202d7682007449dfce56de0f5f243 Mon Sep 17 00:00:00 2001 From: gaberudy Date: Mon, 21 May 2018 10:37:57 -0700 Subject: [PATCH] no-cache smart queries are throwing exceptions in optimistic UI updates (#280) This short circuits unproductive cache work for no-cache queries that will not exist --- src/smart-query.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/smart-query.js b/src/smart-query.js index b9ff8e5..3b21ce7 100644 --- a/src/smart-query.js +++ b/src/smart-query.js @@ -87,10 +87,12 @@ export default class SmartQuery extends SmartApollo { }) } - const currentResult = this.maySetLoading() + if (this.options.fetchPolicy !== "no-cache") { + const currentResult = this.maySetLoading() - if (!currentResult.loading) { - this.nextResult(currentResult) + if (!currentResult.loading) { + this.nextResult(currentResult) + } } super.executeApollo(variables)