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
|
||||
if (conn) {
|
||||
setDrawerState(d => {
|
||||
d.connection = conn
|
||||
d.connection = { ...conn }
|
||||
if (drawerState.selectedID === latestConntion.current.id) {
|
||||
d.connection.completed = latestConntion.current.completed
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import produce from 'immer'
|
||||
import { useState, useMemo, useRef, useCallback } from 'react'
|
||||
|
||||
import * as API from '@lib/request'
|
||||
@ -39,9 +40,11 @@ class Store {
|
||||
} else {
|
||||
const connection = this.connections.get(id)
|
||||
if (connection != null) {
|
||||
connection.completed = true
|
||||
connection.uploadSpeed = 0
|
||||
connection.downloadSpeed = 0
|
||||
this.connections.set(id, produce(connection, draft => {
|
||||
draft.completed = true
|
||||
draft.uploadSpeed = 0
|
||||
draft.downloadSpeed = 0
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user