Skip to content

Autocomplete (lazy) vue component overwriting node name when opening #382

@Luuk-Meijer

Description

@Luuk-Meijer

When we open a node in de admin panel and you have a category selected as node link the title is always set to the name of the category, even if something else is inside of that already.
This creates an issue when you have a custom title with a category.

The fix is luckily simple, but needs to be processed.

Something like this:

Index:view/adminhtml/web/vue/field-type/autocomplete-lazy.vue
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/view/adminhtml/web/vue/field-type/autocomplete-lazy.vue b/view/adminhtml/web/vue/field-type/autocomplete-lazy.vue
--- a/view/adminhtml/web/vue/field-type/autocomplete-lazy.vue
+++ b/view/adminhtml/web/vue/field-type/autocomplete-lazy.vue	(date 1759918698209)
@@ -234,7 +234,9 @@
                     }
                     else if (option && typeof option === 'string') {
                         this.$set(this.item, this.itemKey, option);
-                        this.$set(this.item, 'title', this.options.find(item => item.value === option)?.label);
+                        if (!this.item.title) {
+                            this.$set(this.item, 'title', this.options.find(item => item.value === option)?.label);
+                        }
                     }
                     else {
                         this.$set(this.item, this.itemKey, this.defaultSelectedOption ? this.defaultSelectedOption.value.toString() : '');

This also happens in the normal autocomplete, view/adminhtml/web/vue/field-type/autocomplete.vue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions