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

Keyframe hydration fails due to incorrect keyframe parsing as cache key #383

Open
lxsmnsyc opened this issue Nov 16, 2020 · 4 comments
Open

Comments

@lxsmnsyc
Copy link

lxsmnsyc commented Nov 16, 2020

Server-rendered keyframe cache:
image

Client-rendered keyframe cache:
image

This breaks most of the animation in our website. You can visit the initial animation on our website here and notice how the spinners go from 'spinning' to 'translating' after the hydration process.

Code below is the one I used to track the generated keyframes
image

@tajo tajo mentioned this issue Dec 22, 2020
@tajo
Copy link
Member

tajo commented Dec 29, 2020

Quick workaround is to use styletron-engine-monolithic instead of styletron-engine-atomic since it doesn't use regexp based hydration. It seems that the regexp for keyframes doesn't really work properly. Trying to come up with one that works but it might need some other approach since regexps are not really good when dealing with recursion.

@tajo
Copy link
Member

tajo commented Dec 29, 2020

@rtsao This is what happens when trying to hydrate the example above: https://regex101.com/r/DuqFPv/1

Afaik, to parse that properly we would need to match nested {} correctly and that's not solvable with a regular expression in JS. I guess we need to add some better algo to parse that. I am surprised this has not been reported before?

Or am I missing something? If not, I can try to come up with fix.

@lxsmnsyc
Copy link
Author

Quick workaround is to use styletron-engine-monolithic instead of styletron-engine-atomic since it doesn't use regexp based hydration. It seems that the regexp for keyframes doesn't really work properly. Trying to come up with one that works but it might need some other approach since regexps are not really good when dealing with recursion.

Does this work seamlessly with Base Web?

@tajo
Copy link
Member

tajo commented Dec 29, 2020

Does this work seamlessly with Base Web?

The monolithic engine? Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants