get rid of the last create_effect call

This commit is contained in:
Jeremy Wall 2022-12-31 17:45:39 -06:00
parent b8b11e07a4
commit cdf95c5206

View File

@ -48,9 +48,13 @@ pub fn AddRecipe<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View
)
});
// TODO(jwall): This create effect should no longer be necessary;
create_effect(cx, move || {
create_recipe_signal.track();
view! {cx,
label(for="recipe_title") { "Recipe Title" }
input(bind:value=recipe_title, type="text", name="recipe_title", id="recipe_title", on:change=move |_| {
dirty.set(true);
})
button(on:click=move |_| {
create_recipe_signal.trigger_subscribers();
if !*dirty.get_untracked() {
return;
}
@ -78,14 +82,6 @@ pub fn AddRecipe<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View
.expect("Unable to navigate to recipe");
}
});
});
view! {cx,
label(for="recipe_title") { "Recipe Title" }
input(bind:value=recipe_title, type="text", name="recipe_title", id="recipe_title", on:change=move |_| {
dirty.set(true);
})
button(on:click=move |_| {
create_recipe_signal.trigger_subscribers();
}) { "Create" }
}
}