Issue #2883Opened July 8, 2020by j2l0 reactions

Ignore, bad use of Trait

Question

Hello,

Version: 0.16.18 Are you able to reproduce the bug from the demo? [X] Yes [ ] No

What is the expected behavior? Only add one trait, being able to test empty trait addition

Describe the bug detailed Adding trait with:

            const component = editor.getSelected();
            if (!component.getAttributes()['newtrait']) {
                component.addTrait('newtrait');
            }

Adds a new empty trait ... each time this component is selected: grapes

Because getAttributes is undefined:

editor.getSelected().getAttributes()['newtrait']
undefined

Until I fill newtrait with a value and newtrait value exists. It still keeps all the duplicate fields: grapes2

Maybe I missed something? Or is it a bug? Thank you EDIT: fixed by setting a value to the trait afterward :) Obvious, sorry!

Answers (0)

No answers yet.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.