[fix] no react to current user changes
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
},
|
},
|
||||||
"productName": "CS工具箱",
|
"productName": "CS工具箱",
|
||||||
"mainBinaryName": "cstb",
|
"mainBinaryName": "cstb",
|
||||||
"version": "0.0.6-beta.1",
|
"version": "0.0.6-beta.2",
|
||||||
"identifier": "upup.cool",
|
"identifier": "upup.cool",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"deep-link": {
|
"deep-link": {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { toolStore, useToolStore } from "@/store/tool"
|
|||||||
import { addToast } from "@heroui/react"
|
import { addToast } from "@heroui/react"
|
||||||
import { invoke } from "@tauri-apps/api/core"
|
import { invoke } from "@tauri-apps/api/core"
|
||||||
import { listen } from "@tauri-apps/api/event"
|
import { listen } from "@tauri-apps/api/event"
|
||||||
import { useDebounce, useDebounceEffect, useDebounceFn } from "ahooks"
|
import { useDebounce } from "ahooks"
|
||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import "./globals.css"
|
import "./globals.css"
|
||||||
import Providers from "./providers"
|
import Providers from "./providers"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { addToast, NumberInput, Tab, Tabs, Tooltip } from "@heroui/react"
|
|||||||
import { motion } from "framer-motion"
|
import { motion } from "framer-motion"
|
||||||
import { useToolStore, VideoSetting as VideoConfig, VideoSettingTemplate } from "@/store/tool"
|
import { useToolStore, VideoSetting as VideoConfig, VideoSettingTemplate } from "@/store/tool"
|
||||||
import { useSteamStore } from "@/store/steam"
|
import { useSteamStore } from "@/store/steam"
|
||||||
|
import { useDebounce } from "ahooks"
|
||||||
|
|
||||||
const VideoSetting = () => {
|
const VideoSetting = () => {
|
||||||
const [hide, setHide] = useState(false)
|
const [hide, setHide] = useState(false)
|
||||||
@@ -253,6 +254,17 @@ const VideoSetting = () => {
|
|||||||
void tool.getVideoConfig(steam.state.steamDir, steam.currentUser()?.steam_id32 || 0)
|
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 (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user