Skip to content
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(emoji-picker): NO-JIRA refactor fix ref reactivity in vue2 #3

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default {

data () {
return {
tabLabelsRefs: [],
emojiRefs: [],
emojiFilteredRefs: [],
isFiltering: false,
Expand Down Expand Up @@ -257,7 +258,7 @@ export default {
this.tabSetLabels?.forEach((_, index) => {
const refKey = `tabLabelRef-${index}`;
if (this.$refs[refKey]) {
this.$set(this.tabLabels, index, { ...this.tabLabels[index], ref: this.$refs[refKey] });
this.$set(this.tabLabelsRefs, index, { ref: this.$refs[refKey] });
}
Comment on lines 258 to 262
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This approach may still have reactivity issues. Consider using Vue.set() or this.$set() to ensure reactivity

});
},
Expand Down Expand Up @@ -329,8 +330,7 @@ export default {
scrollToTab: function (tabIndex, focusFirstEmoji) {
const vm = this;
if (focusFirstEmoji === undefined) { focusFirstEmoji = true; }
const tabLabel = vm.tabLabels[tabIndex - 1];
const tabElement = tabLabel.ref[0];
const tabElement = vm.tabLabelsRefs[tabIndex - 1].ref[0];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Ensure tabIndex - 1 is always >= 0 to prevent accessing undefined array elements


vm.$nextTick(function () {
const container = vm.$refs.listRef;
Expand Down