Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-Side Rendering (SSR) #931

Closed
jheer opened this issue Feb 27, 2024 · 5 comments · Fixed by #1523
Closed

Server-Side Rendering (SSR) #931

jheer opened this issue Feb 27, 2024 · 5 comments · Fixed by #1523
Labels
enhancement New feature or request

Comments

@jheer
Copy link

jheer commented Feb 27, 2024

Thanks for the great work on Framework!

For even faster (perceived) page loads it would be valuable to render initial views of charts and other content on the server, then "hydrate" them on the client once corresponding runtime cells are ready. For example, I'd like to publish static SVG as part of the initial page content, which can then be replaced with "live" content upon load.

I realize there be dragons here, especially with arbitrary code that may involve randomness, generators, or otherwise cause strange changes of content upon hydration, and so on. Nevertheless, I see a lot of value in being able to knowingly opt-in to SSR.

I imagine one would have to instantiate a runtime during server-side compilation then extract resulting content. We do something similar in Living Papers using Puppeteer to extract and screenshot runtime-generated content, though a lighter weight approach (e.g., using jsdom and node canvas?) may be preferable and cover common use cases.

It looks like some work in this direction is ongoing, though I'm not sure of the planned scope. So, just wanted to share a plug for this!

@jheer jheer added the enhancement New feature or request label Feb 27, 2024
@mbostock
Copy link
Member

Related #234 #141.

@Fil
Copy link
Contributor

Fil commented Feb 28, 2024

As a complement/alternative/easy first step, I would like to think about registering cell dimensions #933.

@jaanli
Copy link

jaanli commented Mar 1, 2024

Agreed! This would support very cool use cases, added a discussion as well:

#855

@mbostock mbostock changed the title Support Server-Side Rendering (SSR) Server-Side Rendering (SSR) Mar 2, 2024
@mbostock mbostock mentioned this issue Apr 9, 2024
4 tasks
@Fil
Copy link
Contributor

Fil commented Sep 3, 2024

Maybe we should reopen this issue, which is mentioned in

In the future we intend to support other JSX-compatible frameworks, such as Preact. We are also working on server-side rendering with client-side hydration; please upvote [#931](https://github.com/observablehq/framework/issues/931) if you are interested in this feature.
and not completely completed? Or open a new one with new goals (SSR code blocks, hydration…).

@mbostock
Copy link
Member

mbostock commented Sep 3, 2024

We have #234 #145 already so let’s keep this closed. We could open up another issue for JSX hydration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants