grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

BUG: Select options are not displaying. Rather displaying as input

Open codingmachine16 opened this issue 5 years ago • 15 comments

Hi @artf,

We are using select options as Traits but these are displaying as input. sometimes theese display options and sometimes displaying as input . Our code is below

    defaults: Object.assign({}, defaultModel.prototype.defaults, {
      traits: [
        {
          label: "Categories",
          name: "noOfCategories",
          id: "noOfCategories",
          type: "select",
          options: [
            {
              id: "0",
              name: "None",
            },

            {
              id: "1",
              name: "1",
            },
            {
              id: "2",
              name: "2",
            },
            {
              id: "3",
              name: "3",
            },
            {
              id: "4",
              name: "4",
            },
            {
              id: "5",
              name: "5",
            },
            {
              id: "6",
              name: "6",
            },
            {
              id: "7",
              name: "7",
            },
            {
              id: "8",
              name: "8",
            },
            {
              id: "9",
              name: "9",
            },
            {
              id: "10",
              name: "10",
            },
          ],
          changeProp: 1,
        },
        {
          label: "Links",
          name: "noOfLinks",
          id: "noOfLinks",
          type: "select",
          options: [
            {
              id: "0",
              name: "none",
            },
            {
              id: "1",
              name: "1",
            },
            {
              id: "2",
              name: "2",
            },
            {
              id: "3",
              name: "3",
            },
            {
              id: "4",
              name: "4",
            },
          ],
          changeProp: 1,
        },
      ],
    }),

image

codingmachine16 avatar Aug 30 '21 19:08 codingmachine16

@codingmachine16 and @artf I got the same error today.

Screen Shot 2021-09-01 at 15 30 44 Screen Shot 2021-09-01 at 15 32 14

calazans10 avatar Sep 01 '21 18:09 calazans10

Weird thing, can anybody provide a simple reproducible demo as I'm not able to reproduce?

artf avatar Sep 02 '21 12:09 artf

@artf Here's the demo. light-knee.surge.sh I did it using grapesjs-cli as I was trying to create my own plugin.

calazans10 avatar Sep 02 '21 13:09 calazans10

@artf Just to add that we bumped into this these 2 days as well. This seems only happen to version 0.17.25. Following is Jsfiddle for reproducing the issue, if needed please check: https://jsfiddle.net/a29h7twy/5/

Reproduce step:

  1. Drag a component into canvas
  2. Select the component and click settings button to check the traits
  3. Select trait is displayed as input. In dev tool console some warnings are shown

YumiChen avatar Sep 03 '21 03:09 YumiChen

Same for me in v0.17.22 and 0.17.25 Warning in the console when clicking on trait Screen Shot 2021-09-03 at 3 43 51 PM

mmotov avatar Sep 03 '21 12:09 mmotov

I have bumped into this same issue.

I think it is due to this.updatedCollection(); being called in the TraisView component. The result is that the traits aren't initialised.

I managed to fix it by removing the this.updatedCollection; and then updatedCollection it in trait_manager/index.js:

    render() {
      TraitsViewer && TraitsViewer.remove();
      TraitsViewer = new TraitsView({
        collection: [],
        editor: c.em,
        config: c
      });
      TraitsViewer.itemsView = types;
      TraitsViewer.updatedCollection();
      return TraitsViewer.render().el;
    },

Not sure if this is the right way to go about it but does solve the issue for me.

sarelp avatar Sep 07 '21 01:09 sarelp

Yes, you're right @sarelp It's actually wrong calling updatedCollection on initialize, I'll fix it in the next release.

artf avatar Sep 08 '21 14:09 artf

Hi @artf

This issue is still there. When will this be fixed?

[Traits]: 'select' type not found {level: 'warning'}

codingmachine16 avatar Sep 15 '21 14:09 codingmachine16

When we drag component and click on the element on which traits are set , it shows input text instead of select box. On the other hand, after component drag, if we click on any other element and then click on that element which has traits then select box will display. very strange!

codingmachine16 avatar Sep 15 '21 14:09 codingmachine16

When we drag component and click on the element on which traits are set , it shows input text instead of select box. On the other hand, after component drag, if we click on any other element and then click on that element which has traits then select box will display. very strange!

I can confirm this is happening to me on 0.17.25 version also for types: select, number and checkbox.

markovic-nikola avatar Sep 15 '21 14:09 markovic-nikola

This issue is averting us to deploy our projects . Need a fast solution.

codingmachine16 avatar Sep 15 '21 14:09 codingmachine16

@codingmachine16 If I'm not mistaken, the issue is already fixed, @artf just needs to push the new version.

markovic-nikola avatar Sep 15 '21 14:09 markovic-nikola

@codingmachine16 you have to wait for the release

artf avatar Sep 16 '21 11:09 artf

OK . Sure. Thanks. For information, this issue does not exist on 0.17.22

codingmachine16 avatar Sep 16 '21 11:09 codingmachine16

OK . Sure. Thanks. For information, this issue does not exist on 0.17.22

Good to know, since I need to release it within a project soon.

markovic-nikola avatar Sep 16 '21 11:09 markovic-nikola