enonic / lib-react4xp

React for XP: handling and rendering of pre-built React components in Enonic XP
Apache License 2.0
2 stars 2 forks source link

Use @enonic/react-component RichText component to render macros serverside #829

Open ComLock opened 1 year ago

ComLock commented 1 year ago

processHtml will turn macros into html comments Enonic XP post processing will turn html comments into actual html

Guillotine does something https://developer.enonic.com/docs/guillotine/stable/usage#macros

Hopefully we have some JS API for this...

They where close :) https://github.com/enonic/lib-react4xp/issues/128 Related security issues? https://github.com/enonic/lib-react4xp/issues/33

ComLock commented 1 year ago

This is how Guillotine serializes a macro https://github.com/enonic/lib-guillotine/blob/68860723c174cdd86d4115b84db6b2ece66ef883/src/main/java/com/enonic/lib/guillotine/handler/ProcessHtmlHandler.java#L92

ComLock commented 1 year ago

I can confirm that clientSide rendering fails, and that SSR works (probably transformed by Enonic XP (https://developer.enonic.com/docs/xp/stable/framework/http#http-response)

Hydration seems to work, I suspect as soon there is some effects/state it will overwrite SSR with the html comment, but I have not confirmed this yet.