From e2ec9a0388c3d0869621a13d395bf32081cdd6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=A3=8A?= <386159234@qq.com> Date: Wed, 10 Apr 2024 12:07:20 +0800 Subject: [PATCH] fix: https://github.com/rust-lang/cargo/issues/6313 --- src-tauri/Cargo.lock | 4 ++-- src-tauri/Cargo.toml | 13 +++++++------ src-tauri/src/main.rs | 2 +- src/components/sider-layout/index.tsx | 6 +++++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index c2380fb..05015ca 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2774,8 +2774,8 @@ dependencies = [ ] [[package]] -name = "ssstonetools" -version = "0.0.0" +name = "ssstone_tools" +version = "0.0.1" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fd0ec7b..50f6f6f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,10 +1,15 @@ [package] -name = "ssstonetools" -version = "0.0.0" +name = "ssstone_tools" +version = "0.0.1" description = "A Tauri App" authors = ["you"] edition = "2021" +[lib] +name = "ssstone_tools_lib" +crate-type = ["staticlib", "cdylib", "rlib"] + + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] @@ -19,7 +24,3 @@ tauri-plugin-shell = "2.0.0-beta.3" [features] # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! custom-protocol = ["tauri/custom-protocol"] - -[lib] -name = "app_lib" -crate-type = ["staticlib", "cdylib", "rlib", "lib"] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c672c6a..c884b5b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,5 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { - app_lib::run(); + ssstone_tools_lib::run(); } diff --git a/src/components/sider-layout/index.tsx b/src/components/sider-layout/index.tsx index 2386bc7..a032707 100644 --- a/src/components/sider-layout/index.tsx +++ b/src/components/sider-layout/index.tsx @@ -37,8 +37,12 @@ const SiderLayout = () => { navigate([...keyPath].reverse().join('/')); }; - const selectedKeys = useMemo(() => location.pathname.split('/').filter(Boolean), [location.pathname]); + const selectedKeys = useMemo(() => { + const keys = location.pathname.split('/').filter(Boolean); + return keys.length ? keys : ['home']; + }, [location.pathname]); + console.log('selectedKeys', selectedKeys); return (