From 3ba5531c033ec207ced5ad13bc14bb607713ea41 Mon Sep 17 00:00:00 2001 From: Miguel Oller Date: Sat, 16 Mar 2019 22:20:53 -0400 Subject: [PATCH] Remove batch arg from createListenerCollection This prevents a bug with Terser (webpack's default minifier) where the returned batch function isn't defined due to function inlining. --- src/utils/Subscription.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/Subscription.js b/src/utils/Subscription.js index 4c73b072d..e03f4838a 100644 --- a/src/utils/Subscription.js +++ b/src/utils/Subscription.js @@ -7,7 +7,8 @@ import { getBatch } from './batch' const CLEARED = null const nullListeners = { notify() {} } -function createListenerCollection(batch) { +function createListenerCollection() { + const batch = getBatch() // the current/next pattern is copied from redux's createStore code. // TODO: refactor+expose that code to be reusable here? let current = [] @@ -83,7 +84,7 @@ export default class Subscription { ? this.parentSub.addNestedSub(this.handleChangeWrapper) : this.store.subscribe(this.handleChangeWrapper) - this.listeners = createListenerCollection(getBatch()) + this.listeners = createListenerCollection() } }