-
Notifications
You must be signed in to change notification settings - Fork 113
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
Performance issue #110
Comments
Hi @hyanmandian, could you describe what you mean by a 'performance issue'? Have you actually verified that memory usage is increasing? Extra renders are happening? Would you please be able to send us a Codesandbox to demonstrate how you're using the library? |
Sure, good idea :D Version: 2.3.1 -> https://codesandbox.io/s/5z55m8wk3k |
If you use "why-did-you-update" library, you will see a lot of logs about Provider and Consumer components |
OK, thanks for the details. Will have a bit of dig! |
Sorry, miss click... So, I think that this issue happens in this file -> https://github.com/springload/react-accessible-accordion/blob/master/src/AccordionItem/accordion-item-wrapper.js Maybe because you create a Provider and Subscribe for each item. |
I have an idea to solve that. I will send you a PR with this idea, just sec. |
I tried in here, but I think that I need to study how use TS first (I don't have any exp with TS)... But basically the idea is move the accordion-item-wrapper.js Provider and Subscribe components to accordion.js and pass those props to childrens using React.cloneElement. Something like that: // accordion.js
render() {
const { accordion, children, ...rest } = this.props;
return (
<Provider inject={[this.itemContainer]}>
<Subscribe to={[AccordionContainer, ItemContainer]}>
{(accordionStore, itemStore) => {
const { uuid } = itemStore.state;
return (
<div role={accordion ? 'tablist' : null} {...rest}>
{React.Children.map(children, (item) => React.cloneElement(item, {
accordionStore,
itemStore,
}))}
</div>
);
}}
</Subscribe>
</Provider>
);
} If I have time, I will try to help you with it. |
@hyanmandian, our apologies for the delay - but I think I've resolved this. I've published a pre-release |
@ryami333 Sorry for the delay :(I tested the last version 2.4.4 and the problem is the same -> https://codesandbox.io/s/z60nz3nnv4 |
any updates here? |
Hello :D I don't know why, but I have a performance issue with version 2.4.0, I think that the changes made from 2.3.1 to 2.4.2 make this happen. I don't have time to help you to found it right now, but I would like to warn.
I suppose that the lifecycles refactoring that you did make this issue (maybe why-did-you-update lib can help you to debug)
Thanks!
The text was updated successfully, but these errors were encountered: