Skip to content

Add ability to server render the frame #24

Open
@ceopaludetto

Description

I'm creating a docs website using whyframe and astro, the react integration works pretty well, but every reload on the page causes a little flash in the iframe, so after reading the source code i've imagined if we can expose a createServerApp from the virtual import:

---
// /frames/default.astro
import { createServerApp } from "whyframe:app"

const html = await createServerApp(Astro.url.searchParams.get("frame-id"))
---

<Fragment set:html={html} />

So instead of collecting the id from dataset attributes we can send directly in the frame URL, like so:

<iframe src="/frames/default?frame-id=some-id" />

And then, in the createServerApp internals we dynamic import the frame data and render with the matched framework function(e.g. renderToString). What do you think?

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions