fix(frontend): leptos 0.8 migration fixes - Callback::run, StoredValue::new_local, traits
Some checks failed
Build MIPS Binary / build (push) Failing after 1m22s

This commit is contained in:
spinline
2026-02-09 20:39:23 +03:00
parent e1e8a89579
commit 95a0d59cc4
5 changed files with 15 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ use leptos::logging;
use leptos::task::spawn_local;
use leptos_router::components::{Router, Routes, Route};
use leptos_router::hooks::use_navigate;
// use leptos_router::PossibleRouteMatch; // Bu trait prelude ile gelmeli veya public olmayabilir.
#[component]
pub fn App() -> impl IntoView {

View File

@@ -14,15 +14,15 @@ pub fn ContextMenu(
) -> impl IntoView {
let container_ref = create_node_ref::<html::Div>();
let _ = on_click_outside(container_ref, move |_| on_close.call(()));
let _ = on_click_outside(container_ref, move |_| on_close.run(()));
let handle_action = move |action: &str| {
let hash = torrent_hash.clone();
let action_str = action.to_string();
logging::log!("ContextMenu: Action '{}' for hash '{}'", action_str, hash);
on_action.call((action_str, hash)); // Delegate FIRST
on_close.call(()); // Close menu AFTER
on_action.run((action_str, hash)); // Delegate FIRST
on_close.run(()); // Close menu AFTER
};
if !visible {

View File

@@ -5,6 +5,7 @@ use leptos::task::spawn_local;
use leptos_use::storage::use_local_storage;
use ::codee::string::FromToStringCodec;
use shared::GlobalLimitRequest;
use reactive_graph::traits::{Get, Set, GetUntracked};
use crate::api;
fn format_bytes(bytes: i64) -> String {

View File

@@ -14,13 +14,13 @@ pub fn Modal(
#[prop(into, default = "Cancel".to_string())] cancel_text: String,
#[prop(into, default = false)] is_danger: bool,
) -> impl IntoView {
let title = store_value(title);
let title = StoredValue::new_local(title);
// Eagerly render children to a Fragment, which is Clone
let child_view = store_value(children());
let on_confirm = store_value(on_confirm);
let on_cancel = store_value(on_cancel);
let confirm_text = store_value(confirm_text);
let cancel_text = store_value(cancel_text);
let child_view = StoredValue::new_local(children());
let on_confirm = StoredValue::new_local(on_confirm);
let on_cancel = StoredValue::new_local(on_cancel);
let confirm_text = StoredValue::new_local(confirm_text);
let cancel_text = StoredValue::new_local(cancel_text);
view! {
<Show when=move || visible.get() fallback=|| ()>
@@ -35,7 +35,7 @@ pub fn Modal(
<div class="flex justify-end gap-3">
<button
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2"
on:click=move |_| on_cancel.with_value(|cb| cb.call(()))
on:click=move |_| on_cancel.with_value(|cb| cb.run(()))
>
{cancel_text.get_value()}
</button>
@@ -46,7 +46,7 @@ pub fn Modal(
))
on:click=move |_| {
logging::log!("Modal: Confirm clicked");
on_confirm.with_value(|cb| cb.call(()))
on_confirm.with_value(|cb| cb.run(()))
}
>
{confirm_text.get_value()}

View File

@@ -48,7 +48,7 @@ pub fn AddTorrentModal(
if let Some(dialog) = dialog_ref.get() {
dialog.close();
}
on_close.call(());
on_close.run(());
}
Err(e) => {
logging::error!("Failed to add torrent: {:?}", e);
@@ -64,7 +64,7 @@ pub fn AddTorrentModal(
if let Some(dialog) = dialog_ref.get() {
dialog.close();
}
on_close.call(());
on_close.run(());
};
view! {