Skip to content

Conversation

@vectorsize
Copy link

I did some performance optimizations to your themeable function, since I was having issues inside a scroll event.
Basically avoid looping through keys that are not meant to belong in the original theme, and using Object.assign which seems to be faster.

All tests are passing.

@javivelasco
Copy link
Owner

Great! Thanks!

@javivelasco javivelasco merged commit 3a4bbc3 into javivelasco:master Aug 19, 2016
style[key] && theme[key].indexOf(style[key]) === -1
? `${style[key]} ${theme[key]}`
: theme[key] || style[key]
})), style)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now passed style is mutated in reduce so a theme which is in context gets mutated too.

Copy link
Author

@vectorsize vectorsize Aug 19, 2016

Choose a reason for hiding this comment

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

oops you are right @raveclassic, will fix that, hopefully it doesnt slow down much, thanks for keeping an eye on this!

Copy link
Author

Choose a reason for hiding this comment

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

did a quick fix, still performs better, here:
https://github.com/javivelasco/react-css-themr/pull/13/files

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry, honestly I did not dig deep before merging but I wanted to give a better look before releasing. Thanks for keeping an eye on it @raveclassic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants