-
Notifications
You must be signed in to change notification settings - Fork 87
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
Incremental generation is broken for a template named index in the beta.19 #262
Comments
It's not minimum but it gets the point across. It is a slightly modified version of the incremental generation example from the next docs. use perseus::prelude::*;
use serde::{Deserialize, Serialize};
use sycamore::prelude::*;
#[derive(Serialize, Deserialize, Clone, ReactiveState)]
#[rx(alias = "PageStateRx")]
struct PageState {
title: String,
content: String,
}
#[auto_scope]
fn index_page<G: Html>(cx: Scope, state: &PageStateRx) -> View<G> {
view! { cx,
// Don't worry, there are much better ways of styling in Perseus!
p {
(state.title) (state.content)
}
}
}
#[engine_only_fn]
fn head(cx: Scope) -> View<SsrNode> {
view! { cx,
title { "Welcome to Perseus!" }
}
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("index")
.build_paths_fn(get_build_paths)
.build_state_fn(get_build_state)
.view_with_state(index_page)
.head(head)
.incremental_generation()
.build()
}
#[engine_only_fn]
async fn get_build_state(
StateGeneratorInfo { path, .. }: StateGeneratorInfo<()>,
) -> Result<PageState, BlamedError<std::io::Error>> {
// This path is illegal, and can't be rendered
// Because we're using incremental generation, we could get literally anything
// as the `path`
let title = path.clone();
let content = format!(
"This is a post entitled '{}'. Its original slug was '{}'.",
&title, &path
);
Ok(PageState { title, content })
}
#[engine_only_fn]
async fn get_build_paths() -> BuildPaths {
BuildPaths {
paths: vec!["".to_string()],
extra: ().into(),
}
} |
From some initial testing, it seems like build paths still work perfectly, but incremental generation only works with Chances are, this will be in the routing algorithm, since incremental generation is occurring flawlessly for the |
Okay, this was a simple error on my part: the routing algorithm searches forward by splitting the path into segments over |
This will be in beta 21. |
This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels.
The author described their issue as follows:
The steps to reproduce this issue are as follows:
A minimum reproducible example is available at <>.
Tribble internal data
dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxhdXRob3Itd2lsbGluZy10by1pbXBs
The text was updated successfully, but these errors were encountered: