-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(select): [select] fix component error caused by vue2 deep cleanup memory leak #2843
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,7 +36,7 @@ const initState = ({ reactive, computed, props, api, markRaw, select, parent }) | |||||
disabled: computed(() => props.disabled || state.groupDisabled), | ||||||
isObject: computed(() => Object.prototype.toString.call(props.value).toLowerCase() === '[object object]'), | ||||||
currentLabel: computed(() => props.label || (state.isObject ? '' : props.value)), | ||||||
currentValue: computed(() => props.value || props.label || ''), | ||||||
currentValue: props.value || props.label || '', | ||||||
|
||||||
itemSelected: computed(() => { | ||||||
if (!select.multiple) { | ||||||
|
@@ -90,7 +90,7 @@ const initWatch = ({ watch, props, state, select, constants }) => { | |||||
() => props.value, | ||||||
(value, oldVal) => { | ||||||
const { remote, valueKey } = select | ||||||
|
||||||
state.currentValue = value || props.label || '' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle edge case where value is 0. The fallback chain Consider this alternative implementation: - state.currentValue = value || props.label || ''
+ state.currentValue = value != null ? value : props.label || '' 📝 Committable suggestion
Suggested change
|
||||||
if (!props.created && !remote) { | ||||||
if ( | ||||||
valueKey && | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from
computed
to a direct assignment forcurrentValue
may lead to unexpected behavior ifcurrentValue
is expected to reactively update based on dependencies. Ensure that this change does not break reactive updates elsewhere in the component.