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

Survey Creator with Custom Widgets - The Cannot read properties of undefined (reading 'getType') exception is thrown on an attempt to add a new question #3454

Closed
JaneSjs opened this issue Sep 20, 2022 · 4 comments
Assignees
Labels
Milestone

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented Sep 20, 2022

To reproduce the issue, run the Survey Creator | Custom Widgets | React demo in CodeSandbox, and click Add Question. The following exception is thrown:

Uncaught TypeError: Cannot read properties of undefined (reading 'getType')
    at ./src/property-grid/index.ts.PropertyJSONGenerator.createJSON (index.ts:533:28)
    at ./src/property-grid/index.ts.PropertyJSONGenerator.toJSON (index.ts:457:17)
    at ./src/property-grid/index.ts.PropertyJSONGenerator.setupObjPanel (index.ts:470:25)
    at ./src/property-grid/restfull.ts.PropertyGridEditorQuestionRestfull.onCreated (restfull.ts:42:67)
    at Object.onCreated (index.ts:222:11)
    at ./src/property-grid/index.ts.PropertyJSONGenerator.onQuestionsCreated (index.ts:497:36)
    at ./src/property-grid/index.ts.PropertyJSONGenerator.setupObjPanel (index.ts:471:10)
    at ./src/property-grid/index.ts.PropertyGridModel.setObj (index.ts:757:55)
    at PropertyGridModel.set (index.ts:700:10)
    at ./src/creator-base.ts.CreatorBase.selectionChanged (creator-base.ts:2511:36)
    at ./src/creator-base.ts.CreatorBase.selectElement (creator-base.ts:2362:12)
    at ./src/creator-base.ts.CreatorBase.clickToolboxItem (creator-base.ts:2538:12)
    at ./src/creator-base.ts.CreatorBase.addNewQuestionInPage (creator-base.ts:3050:10)
    at descriptor.value [as addNewQuestionInPage] (index.ts:53:40)
    at ./src/components/page.ts.PageAdorner.addNewQuestion (page.ts:108:18)
    at onClick (Page.tsx:102:20)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16)
    at invokeGuardedCallback (react-dom.development.js:4277:31)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:25)
    at executeDispatch (react-dom.development.js:9041:3)
    at processDispatchQueueItemsInOrder (react-dom.development.js:9073:7)
    at processDispatchQueue (react-dom.development.js:9086:5)
    at dispatchEventsForPlugins (react-dom.development.js:9097:3)
    at eval (react-dom.development.js:9288:12)
    at batchedUpdates$1 (react-dom.development.js:26140:12)
    at batchedUpdates (react-dom.development.js:3991:12)
    at dispatchEventForPluginEventSystem (react-dom.development.js:9287:3)
    at dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay (react-dom.development.js:6465:5)
    at dispatchEvent (react-dom.development.js:6457:5)
    at dispatchDiscreteEvent (react-dom.development.js:6430:5)

CodeSandbox Link.
image

This issue was reported at:

@tsv2013
Copy link
Member

tsv2013 commented Sep 21, 2022

Right now works ok for me. Probably I missed something...

@andrewtelnov
Copy link
Member

@tsv2013 I was able to reproduce the issue. Autocomplete widget cause the problem.

Thank you,
Andrew

@jrej-dev
Copy link

Hello @tsv2013,

Here is a simple example where I had the issue. It's with my stack React/Typescript:
https://github.com/Jrejoire/survey_example

Thanks for your help.

@andrewtelnov
Copy link
Member

@Jrejoire @JaneGaid I have fixed the issue in Custom widget repository.
The issue was with Autocomplete widget.

Thank you,
Andrew

@OlgaLarina OlgaLarina added this to the v1.9.51 milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants