When you call ReactDOMServer.renderToStaticMarkup() with a component that uses framer-motion to render it fails to render those elements but renders non-animated elements correctly. Even with passing { type: false } to the transition it still fails.
Notes on example:
motion.rect are not rendered."react": "16.9.0"
"react-dom": "16.9.0"
"framer-motion": "^1.6.7"
Hmm that's odd, we have SSR-specific tests that work fine. I'll take a look.
@amcdnl Are you still running into this?
@InventingWithMonster - Yes it is still not working. Take a look at the repo link above, I have updated it to latest everything.
Thanks
Oh code link is updated to: https://github.com/reaviz/reaviz/blob/master/src/BarChart/BarSeries/Bar.tsx
Updated tests to specifically test with renderToStaticMarkup and still not finding a problem with this https://github.com/framer/motion/commit/b39009ca0b68fc0f44ca444c3a7b8f558230cb72
If I get time next week I'll see if I can clone your project and take a closer look
Pulling the linked repo and changing the return of Component to motion.rect outputs a <rect> element. The tests in Motion also verify that SVG and HTML elements are both rendered correctly with renderToStaticMarkup.
I don't know exactly what's wrong here but I don't have the time to look into it any further, given the above I can assume the bug here isn't specifically to do with Motion.
@InventingWithMonster - Can you be more clear on what you changed from Component to motion.rect?
The returned createElement of Component in component.tsx
What if you define animations and then disable like I did? https://github.com/reaviz/reaviz/blob/master/src/BarChart/BarSeries/Bar.tsx#L483
If I passed animate I got the same result, a
Most helpful comment
Hmm that's odd, we have SSR-specific tests that work fine. I'll take a look.