mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [select] solve memory leak (#19709)
fix(components): solve memory leak Watching the value of an attribute of an option can lead to a memory leak closed #19680 Co-authored-by: 张东 <A80784@internet.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
import { computed, getCurrentInstance, inject, toRaw, watch } from 'vue'
|
||||
import { get } from 'lodash-unified'
|
||||
import { get, isEqual } from 'lodash-unified'
|
||||
import { ensureArray, escapeStringRegexp, isObject } from '@element-plus/utils'
|
||||
import { selectGroupKey, selectKey } from './token'
|
||||
|
||||
@@ -77,8 +77,8 @@ export function useOption(props, states) {
|
||||
() => props.value,
|
||||
(val, oldVal) => {
|
||||
const { remote, valueKey } = select.props
|
||||
|
||||
if (val !== oldVal) {
|
||||
const shouldUpdate = remote ? val !== oldVal : !isEqual(val, oldVal)
|
||||
if (shouldUpdate) {
|
||||
select.onOptionDestroy(oldVal, instance.proxy)
|
||||
select.onOptionCreate(instance.proxy)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user