From 3ad53b2fa5f7c91a28d4ad05626d8bdaaf34f572 Mon Sep 17 00:00:00 2001 From: AJHenry Date: Mon, 8 Jul 2019 16:45:40 -0400 Subject: [PATCH] Add fix for #136 --- src/Get.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Get.tsx b/src/Get.tsx index 3a211917..9ca12dc9 100644 --- a/src/Get.tsx +++ b/src/Get.tsx @@ -285,6 +285,12 @@ class ContextlessGet extends React.Component< this.setState({ loading: false, data: resolved.data, error: resolved.error }); return data; } catch (e) { + // avoid state updates when component has been unmounted + // and when fetch/processResponse threw an error + if (this.signal.aborted) { + return; + } + this.setState({ loading: false, error: {