From 9cf75634d458a3ba8b4d6d66cf666e6f7b7259fd Mon Sep 17 00:00:00 2001 From: sitek94 Date: Sat, 12 Dec 2020 22:30:04 +0100 Subject: [PATCH] Fix cancelled query error, closes #37 --- src/screens/dashboard.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/screens/dashboard.js b/src/screens/dashboard.js index 3dbb4bc..e21bb81 100644 --- a/src/screens/dashboard.js +++ b/src/screens/dashboard.js @@ -63,8 +63,16 @@ function DashboardScreen() { const error = habitsError || checkmarksError; + /** + * Temporary fix + * + * Cancelled query is throwing `CancelledError`. In V3 cancellation will not throw an error anymore. + * https://github.com/tannerlinsley/react-query/discussions/1179 + */ + const isCancelledError = checkmarksError && checkmarksError.hasOwnProperty('silent'); + // Ignore cancelled errors - if (error && checkmarksError.constructor.name !== 'CancelledError') { + if (error && !isCancelledError) { return ; }