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

Client-side Rendering (CSR) #7

Open
exastencil opened this issue Mar 17, 2024 · 0 comments
Open

Client-side Rendering (CSR) #7

exastencil opened this issue Mar 17, 2024 · 0 comments
Assignees
Labels
core A core feature new Something that needs to be built from scratch
Milestone

Comments

@exastencil
Copy link
Owner

Since the Component API is designed to be isomorphic, we can compile components, ship them to the browser and replicate the work the server does there. This allows state changes and navigation not to need a round trip.

This is one of the core features needed to make Porous feasible.

In fact some interaction cannot be done without some form of reactive rendering without some sophisticated calls to the server and patching the document with the response (a la Turbo, Live View, htmx, etc).

There's a narrow window between CSS interactivity (animations, hover states, resizing, etc) and full page re-renders where arguably most applications live. Most of these cases can be filled with custom Web Components or a similar solution, but I feel the simplest way is to have declarative markup and render it reactively, so there is less ceremony on where the functionality lies: in the page, in a component or in a component in a component – it shouldn't really matter.

The challenge here is the heaviness that any solution brings. Good solutions (in my opinion) are things like Bud, which has a Go router with some JavaScript frontend framework for views. However, this requires constant language context switching (potentially between differently-typed languages), two language runtimes in development and data plumbing between the router and views.

So in our case we either turn the Ruby into JavaScript to run in the browser (the Opal route) or ship a Ruby runtime (as WebAssembly) and run the Ruby itself in the browser. Transpilation to JavaScript produces more assets to ship and interpret, but loading a Ruby runtime adds a lot of initial overhead on each page load. Both introduce complexities for reloading code in development, but the runtime approach will probably deal with module reloading better.

@exastencil exastencil added core A core feature new Something that needs to be built from scratch labels Mar 17, 2024
@exastencil exastencil added this to the v1.0 milestone Mar 17, 2024
@exastencil exastencil self-assigned this Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core A core feature new Something that needs to be built from scratch
Projects
None yet
Development

No branches or pull requests

1 participant