-
Notifications
You must be signed in to change notification settings - Fork 187
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
Allow already injected to be reset #380
Conversation
@lencioni You have any feedback? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone from Khan please take a look as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test?
@lencioni Not sure how to test this since |
@milesj how about an integration test that uses aphrodite to inject styles into the DOM, and then removes the styles, and then calls your new function, and then uses aphrodite to inject that style into the DOM again and verify that all worked? |
@lencioni Added. |
Thanks for the test! Do you know why CI is failing on Node 6? |
@lencioni I do not but will look into it. I'd also suggest just dropping v6 since it's LTS is over. |
@lencioni @kevinbarabash Any update here? |
Thanks for the ping! I'd really like for someone from Khan to review this. @kevinbarabash can you help with that? |
Bump? @kevinbarabash |
to: @lencioni
We have some logic in our app that deletes injected CSS rules (mostly global styles). This works great.
However, once the styles are regenerated and attempt to inject again, they will not as Aphrodite blocks the injection because the previous key is set to
alreadyInjected
. /~https://github.com/Khan/aphrodite/blob/master/src/inject.js#L159This PR adds a minor function called
resetInjected
to clear this cache. I also went ahead and exportedreset
since it may also be useful.Not sure how to test this since all the logic is abstracted away.