Is there a way to make an iframe reactively render with state/signals from its parent?

Stuff that I tried: - Set state/setState in the iframe.window.someGlobal and access it in the iframe from there - Wrap createState in createRoot - Render the iframe solid app with runWithOwner with the owner of the parent app I know there are alternatives, but each of them have drawbacks: a. Send state changes between parent/iframe and update state with reconcile (Drawback: Performance) b. Render the iframe content directly in the parent (Drawback: CSS inconsistency, certain libraries with document side effects break, event delegation has to be manually registered) Currently I use the a.) alternative, but I'd really like to get rid of the state reconcilation somehow 🙈
5 Replies
bigmistqke
bigmistqke2y ago
what about window.postMessage?
Katja (katywings)
Jupp thats what I do in a.), I currently use postMessage and reconcile the state changes between parent<->iframe 😅
bigmistqke
bigmistqke2y ago
coool
Katja (katywings)
Ohh veerrry interesting 😮! Thank you for the demo 👍! Sadly in my case both sides need to work with "generic" solid components properly importing their dependencies. But atleast now i know that its definitely a tradeoff in the solid core, and not a problem with iframe security 🙂.
Want results from more Discord servers?
Add your server