mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-03-22 15:08:22 +08:00
fix(usage): prevent usage script config from leaking between providers
Add key prop to UsageScriptModal to ensure component remounts when switching between different providers. This fixes issue #569 where configuring usage query for one provider would incorrectly apply the same configuration to all providers. The root cause was that useState initialization only runs on first mount, and due to useLastValidValue hook keeping the modal rendered during close animation, the component might not fully unmount when switching providers rapidly. Closes #569
This commit is contained in:
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -701,7 +701,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc-switch"
|
||||
version = "3.9.0"
|
||||
version = "3.9.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
|
||||
@@ -806,6 +806,7 @@ function App() {
|
||||
|
||||
{effectiveUsageProvider && (
|
||||
<UsageScriptModal
|
||||
key={effectiveUsageProvider.id}
|
||||
provider={effectiveUsageProvider}
|
||||
appId={activeApp}
|
||||
isOpen={Boolean(usageProvider)}
|
||||
|
||||
Reference in New Issue
Block a user