Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/informer: simplify render method #3931

Merged
merged 1 commit into from Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 4 additions & 11 deletions packages/@uppy/informer/src/TransitionGroup.js
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we are not solving / getting rid of the todo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My change has nothing to do with the TODO, the TODO comes from https://github.com/developit/preact-transition-group/blob/f4ad5e3121729819aa3670edb79388036fb60ebc/src/TransitionGroup.js#L199, it was written by folks more informed than I am, I'm too afraid to touch it at this point.

// 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 => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lost the key here somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have a duplicate at my place, let me take a look.

Copy link
Member Author

@aduh95 aduh95 Aug 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5fca617, sorry for the trouble.

const ref = linkRef(this, key);
return cloneElement(childFactory(child), { ref, key })
})

return h(component, props, childrenToRender)
}
Expand Down