From 01ab46ee3bf76a9e656f78896b39aec4627b01a1 Mon Sep 17 00:00:00 2001 From: Forrest Li Date: Wed, 7 Jul 2021 15:16:02 -0400 Subject: [PATCH] fix(ShareDataSet): Stop data listener on unmount The trivial producer listener should be removed when the component is unmounted. --- src/core/ShareDataSet.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/ShareDataSet.js b/src/core/ShareDataSet.js index acfcabf..e2db075 100644 --- a/src/core/ShareDataSet.js +++ b/src/core/ShareDataSet.js @@ -46,6 +46,13 @@ export default class ShareDataSet extends Component { return trivialProducer; } + componentWillUnmount() { + if (this.subscription) { + this.subscription.unsubscribe(); + this.subscription = null; + } + } + render() { this.update(); return (