[fix] no react to current user changes

This commit is contained in:
Purp1e
2025-04-02 23:05:07 +08:00
parent c5330aec8f
commit 3dc271866f
3 changed files with 14 additions and 2 deletions

View File

@@ -44,7 +44,7 @@
},
"productName": "CS工具箱",
"mainBinaryName": "cstb",
"version": "0.0.6-beta.1",
"version": "0.0.6-beta.2",
"identifier": "upup.cool",
"plugins": {
"deep-link": {

View File

@@ -5,7 +5,7 @@ import { toolStore, useToolStore } from "@/store/tool"
import { addToast } from "@heroui/react"
import { invoke } from "@tauri-apps/api/core"
import { listen } from "@tauri-apps/api/event"
import { useDebounce, useDebounceEffect, useDebounceFn } from "ahooks"
import { useDebounce } from "ahooks"
import { useEffect } from "react"
import "./globals.css"
import Providers from "./providers"

View File

@@ -6,6 +6,7 @@ import { addToast, NumberInput, Tab, Tabs, Tooltip } from "@heroui/react"
import { motion } from "framer-motion"
import { useToolStore, VideoSetting as VideoConfig, VideoSettingTemplate } from "@/store/tool"
import { useSteamStore } from "@/store/steam"
import { useDebounce } from "ahooks"
const VideoSetting = () => {
const [hide, setHide] = useState(false)
@@ -253,6 +254,17 @@ const VideoSetting = () => {
void tool.getVideoConfig(steam.state.steamDir, steam.currentUser()?.steam_id32 || 0)
}, [])
const debounceCurrentUserId = useDebounce(steam.currentUser()?.steam_id32, {
wait: 500,
leading: false,
trailing: true,
maxWait: 2500,
})
useEffect(() => {
if (steam.state.steamDirValid && steam.currentUser())
void tool.getVideoConfig(steam.state.steamDir, steam.currentUser()?.steam_id32 || 0)
}, [debounceCurrentUserId])
return (
<Card>
<CardHeader>