surveyjs / survey-creator

Scalable open-source survey software to generate dynamic JSON-driven forms within your JavaScript application. The form builder features a drag-and-drop UI, CSS Theme Editor, and GUI for conditional logic and form branching.
https://surveyjs.io/open-source
Other
863 stars 363 forks source link

Overwriting items propery of multipletext crashes editor #2945

Open radwouters opened 2 years ago

radwouters commented 2 years ago

Are you requesting a feature, reporting a bug or ask a question?

Reporting a bug

What is the current behavior?

When overwriting the items property of a custom question which extends multipletext with a itemvalue[], the editor crashes with a Maximum call stack exceeded error.

What is the expected behavior?

The field is overwritten without any crashes

How would you reproduce the current behavior (if this is a bug)?

  1. Create a custom question type with the code below
  2. Add the custom question to a survey
  3. Go to the JSON Editor tab

Provide the test code and the tested page URL (if applicable)

Test code

Survey.Serializer.addClass("customquestion", [
        {
          name: "items",
          category: "items",
          type: "itemvalue[]",
        }
      ], null, "multipletext");

Specify your

andrewtelnov commented 2 years ago

@radwouters I could not reproduce the issue. Here is the version for React and for knockout.

Thank you, Andrew

SamMousa commented 2 years ago

It seems that the new creator doesn't show the question type at all though...

@radwouters I think the minimal example needs some more reproduction code (the registration with the widget collection is missing).

Ideally just adapt the plunker (https://plnkr.co/edit/10hRT5YPpKJgcFmH) so that it breaks. We'll immediately also now if the bug is also in v2.

andrewtelnov commented 2 years ago

@SamMousa You have to register the question in ElementFactory, or add it into toolbox manually, like in this example. Adding a new class is not enough.

Thank you, Andrew

SamMousa commented 2 years ago

I know, that's why I asked @radwouters (who is working for me on a SurveyJS feature) to add that missing code. In our version control it is there, which is why this bug report came to exist, it just wasn't included in the example!

Also, the example you linked doesn't actually work. Try adding the question and then adding an option and it won't work. (It doesn't crash the same way in creator v1 though)

radwouters commented 2 years ago

I have managed to make a minimal example in a plunker, but now it gives a different error: https://plnkr.co/edit/Cc0Vh7PSRHxNDVmJ