mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Fix some lifetime annotation issues
This commit is contained in:
parent
69dc4b99cf
commit
fbb4e4ceeb
@ -164,7 +164,7 @@ pub fn Viewer<'ctx, G: Html>(cx: Scope<'ctx>, props: RecipeComponentProps<'ctx>)
|
|||||||
let RecipeComponentProps { recipe_id, sh } = props;
|
let RecipeComponentProps { recipe_id, sh } = props;
|
||||||
let state = app_state::State::get_from_context(cx);
|
let state = app_state::State::get_from_context(cx);
|
||||||
let view = create_signal(cx, View::empty());
|
let view = create_signal(cx, View::empty());
|
||||||
let recipe_signal = sh.get_selector(cx, |state| {
|
let recipe_signal = sh.get_selector(cx, move |state| {
|
||||||
if let Some(recipe) = state.get().recipes.get(&recipe_id) {
|
if let Some(recipe) = state.get().recipes.get(&recipe_id) {
|
||||||
let title = recipe.title.clone();
|
let title = recipe.title.clone();
|
||||||
let desc = recipe.desc.clone().unwrap_or_else(|| String::new());
|
let desc = recipe.desc.clone().unwrap_or_else(|| String::new());
|
||||||
|
@ -11,14 +11,17 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
use crate::{app_state, components::recipe::Viewer};
|
use crate::{
|
||||||
|
app_state::{self, StateHandler},
|
||||||
|
components::recipe::Viewer,
|
||||||
|
};
|
||||||
|
|
||||||
use sycamore::prelude::*;
|
use sycamore::prelude::*;
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
#[instrument]
|
#[instrument(skip_all)]
|
||||||
#[component]
|
#[component]
|
||||||
pub fn RecipeList<G: Html>(cx: Scope) -> View<G> {
|
pub fn RecipeList<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<G> {
|
||||||
let state = app_state::State::get_from_context(cx);
|
let state = app_state::State::get_from_context(cx);
|
||||||
let menu_list = create_memo(cx, move || state.get_menu_list());
|
let menu_list = create_memo(cx, move || state.get_menu_list());
|
||||||
view! {cx,
|
view! {cx,
|
||||||
@ -26,10 +29,10 @@ pub fn RecipeList<G: Html>(cx: Scope) -> View<G> {
|
|||||||
div() {
|
div() {
|
||||||
Indexed(
|
Indexed(
|
||||||
iterable=menu_list,
|
iterable=menu_list,
|
||||||
view= |cx, (id, _count)| {
|
view= move |cx, (id, _count)| {
|
||||||
debug!(id=%id, "Rendering recipe");
|
debug!(id=%id, "Rendering recipe");
|
||||||
view ! {cx,
|
view ! {cx,
|
||||||
Viewer(id)
|
Viewer(recipe_id=id, sh=sh)
|
||||||
hr()
|
hr()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@ pub fn CookPage<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<
|
|||||||
view! {cx,
|
view! {cx,
|
||||||
PlanningPage(
|
PlanningPage(
|
||||||
selected=Some("Cook".to_owned()),
|
selected=Some("Cook".to_owned()),
|
||||||
) { RecipeList() }
|
) { RecipeList(sh) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ use tracing::instrument;
|
|||||||
|
|
||||||
#[instrument(skip_all, fields(recipe=props.recipe))]
|
#[instrument(skip_all, fields(recipe=props.recipe))]
|
||||||
#[component()]
|
#[component()]
|
||||||
pub fn RecipeEditPage<G: Html>(cx: Scope, props: RecipePageProps) -> View<G> {
|
pub fn RecipeEditPage<'ctx, G: Html>(cx: Scope<'ctx>, props: RecipePageProps<'ctx>) -> View<G> {
|
||||||
let RecipePageProps { recipe, sh } = props;
|
let RecipePageProps { recipe, sh } = props;
|
||||||
view! {cx,
|
view! {cx,
|
||||||
RecipePage(
|
RecipePage(
|
||||||
|
@ -20,7 +20,7 @@ use super::{RecipePage, RecipePageProps};
|
|||||||
|
|
||||||
#[instrument(skip_all, fields(recipe=props.recipe))]
|
#[instrument(skip_all, fields(recipe=props.recipe))]
|
||||||
#[component()]
|
#[component()]
|
||||||
pub fn RecipeViewPage<G: Html>(cx: Scope, props: RecipePageProps) -> View<G> {
|
pub fn RecipeViewPage<'ctx, G: Html>(cx: Scope<'ctx>, props: RecipePageProps<'ctx>) -> View<G> {
|
||||||
let RecipePageProps { recipe, sh } = props;
|
let RecipePageProps { recipe, sh } = props;
|
||||||
view! {cx,
|
view! {cx,
|
||||||
RecipePage(
|
RecipePage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user