mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
Fix: mutate freeze object
This commit is contained in:
parent
8404781106
commit
c21d9937fa
@ -224,7 +224,7 @@ export default function Connections () {
|
|||||||
const conn = data.find(c => c.id === drawerState.selectedID)?.original
|
const conn = data.find(c => c.id === drawerState.selectedID)?.original
|
||||||
if (conn) {
|
if (conn) {
|
||||||
setDrawerState(d => {
|
setDrawerState(d => {
|
||||||
d.connection = conn
|
d.connection = { ...conn }
|
||||||
if (drawerState.selectedID === latestConntion.current.id) {
|
if (drawerState.selectedID === latestConntion.current.id) {
|
||||||
d.connection.completed = latestConntion.current.completed
|
d.connection.completed = latestConntion.current.completed
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import produce from 'immer'
|
||||||
import { useState, useMemo, useRef, useCallback } from 'react'
|
import { useState, useMemo, useRef, useCallback } from 'react'
|
||||||
|
|
||||||
import * as API from '@lib/request'
|
import * as API from '@lib/request'
|
||||||
@ -39,9 +40,11 @@ class Store {
|
|||||||
} else {
|
} else {
|
||||||
const connection = this.connections.get(id)
|
const connection = this.connections.get(id)
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.completed = true
|
this.connections.set(id, produce(connection, draft => {
|
||||||
connection.uploadSpeed = 0
|
draft.completed = true
|
||||||
connection.downloadSpeed = 0
|
draft.uploadSpeed = 0
|
||||||
|
draft.downloadSpeed = 0
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user