From 2b16f36155cc97bb71ec4ab13f78078558c903e5 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 1 Aug 2022 15:26:33 +0200 Subject: [PATCH] @uppy/informer: simplify `render` method --- packages/@uppy/informer/src/TransitionGroup.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/@uppy/informer/src/TransitionGroup.js b/packages/@uppy/informer/src/TransitionGroup.js index 56b07dab21..cebce0256b 100644 --- a/packages/@uppy/informer/src/TransitionGroup.js +++ b/packages/@uppy/informer/src/TransitionGroup.js @@ -264,17 +264,10 @@ class TransitionGroup extends Component { render ({ childFactory, transitionLeave, transitionName, transitionAppear, transitionEnter, transitionLeaveTimeout, transitionEnterTimeout, transitionAppearTimeout, component, ...props }, { children }) { // TODO: we could get rid of the need for the wrapper node // by cloning a single child - const childrenToRender = [] - for (const key in children) { - if (children.hasOwnProperty(key)) { - const child = children[key] - if (child) { - const ref = linkRef(this, key), - el = cloneElement(childFactory(child), { ref, key }) - childrenToRender.push(el) - } - } - } + const childrenToRender = Object.values(children).filter(Boolean).map(child => { + const ref = linkRef(this, key); + return cloneElement(childFactory(child), { ref, key }) + }) return h(component, props, childrenToRender) }