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 🌈
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 🌈
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
More Posts
how can I use createEffect so it doesn't rerun when certain signals changemy code: https://github.com/nikitavoloboev/test/blob/main/solid-start/src/routes/snake.tsxForward reference a Component's state in TemplateI try to wrap a Trigger and a Display component in a state managing component like so ``` export fuChild component cannot access context that the parent can access?I have a file like this: ```tsx import { useLexicalComposerContext } from "./LexicalComposerContext"How do I scroll to bottom, on a scrollable content that displays a Show when`<div ref={$content}` `Show when={signal()}` ``` createEffect(() => { set_signal(true) $content.Solid JS force rerender on signal changeI need to force Solid JS to make changes to the DOM every time a signal changes. Currently it seems Generate random numbers serverside and don't regenerate on hydrationI'm trying to generate a list of random numbers for a skeleton loader, and I've found a solution, buHow can we lazy load route data using @solidjs/router ?When using this pattern: ```javascript import UserData from "./pages/users/[id].data.js"; const UseContext In TypescriptI'm trying to create a context in Typescript following this example, but copying and pasting the codVercel + PrismaHopefully someone here can help with my issue, but I'm trying to use Prisma with solid + vercel, howServer rendering error on createResource. Inconsistent HMR.I am currently get this error when calling `npm run dev` and `npm run build` just hangs. ```bash GET