-
Notifications
You must be signed in to change notification settings - Fork 155
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
Question/Feature suggestion: Server side rendering #232
Comments
Why do you need it? I use Seed as a static site generator as an alternative. See seed-quickstart-webpack for an example. |
I've got a login system that dynamically changes the nav menu. I think I want this to happen on the server, since if someone navigates to my site, they'll see the nav menu flash. To do this, I think I need some form of SSR? Then I got carried away thinking about everything else that could use it. Also, the rest of my static pages uses Totally missed the quickstart thing, btw, so thanks. |
I want to fix one type of flashes - see issue #223. But you probably think the flash of content once you loaded info about user and want to show e.g. his name and avatar in the menu. I think there are at least two options:
Try to render |
Well, the real problem I had was how to hook up event listeners, because the wasm is still traveling over the wire and not initialized yet. The thing about prerendering is that I don't want to write out the templates twice, once with listeners for Seed, and once without for maud. Ideally, I would create another macro or something similar that somehow wraps Seed's things so that I can use Also, I just made a PR to allow for the initial |
Hi! My use case is to do the first render on the server, and then "rehydrate" the client to work on a prerendered page. This speeds up the first render and may enable the site to be used with scripts disabled (with some effort). |
@dlight Hi. I would like to know more info, if possible:
|
@MartinKavik I have a related usecase on the client side. I want to render a SVG graphic as const SVG_BG: &str = concat!(
"<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'>",
"<rect width='10' height='10' fill='rgba(76,76,76,1)' />",
"<line x1='0' y1='5' x2='10' y2='5' stroke='rgba(255,255,255,0.25)' stroke-width='0.125' />",
"<line x1='5' y1='0' x2='5' y2='10' stroke='rgba(255,255,255,0.25)' stroke-width='0.125' />",
"</svg>"
); And here it is used: let my_style = style! {
St::BackgroundImage => format!(r#"url("data:image/svg+xml;utf8,{}")"#, SVG_BG);
} It would be cool to do this dynamically like this: let svg_bg = a_seed_view_fn(parameters).to_html_string();
let my_style = style! {
St::BackgroundImage => format!(r#"url("data:image/svg+xml;utf8,{}")"#, svg_bg);
} |
@flosse NP, it's somehow related and I'll need this feature too in Seed's core so we can implement some bigger performance optimizations. |
@MartinKavik - An e-commerce catalog is the perfect use case... SEO is critical. You would SSR the pages for SEO/perf reasons (static generation or actix-web, rocket, etc). Once that content gets consumed via browser user, the seed wasm module should preload the state based on the already loaded in DOM. Or Maybe something on the server can embed “state init” info that can be easily loaded into wasm module. |
|
Sauron has implemented prerendering. Maybe you can take a look at that in this example, https://github.com/ivanceras/sauron/tree/master/examples/progressive-rendering |
It was redirecting to: https://github.com/seed-rs/seed#232 but I think what was meant to be is this: seed-rs#232
It was redirecting to: https://github.com/seed-rs/seed#232 but I think what was meant to be is this: #232
Is server side rendering being considered at all?
It seems borderline impossible in my head without severe restrictions, but I was just wondering.
The text was updated successfully, but these errors were encountered: