sp-dev-fx-controls-react icon indicating copy to clipboard operation
sp-dev-fx-controls-react copied to clipboard

Dynamic form TaxonomyFieldType NPE exception on defaultValue

Open Perneel opened this issue 2 years ago • 1 comments

Category

[ ] Enhancement

[x] Bug

[ ] Question

Version

Please specify what version of the library you are using: [3.15.0]

Observed Behavior

When the dynamic form is initializing, there seems to be an issue when loading a TaxonomyField. The Default value is null, but there is no null check in the code, which results in the following error:

Error get field informations TypeError: Cannot read properties of null (reading 'split')
    at DynamicForm.js:534:66
    at step (DynamicForm.js:58:1)
    at Object.next (DynamicForm.js:39:45)
    at step (DynamicForm.js:43:1)
    at Object.next (DynamicForm.js:39:45)
    at fulfilled (DynamicForm.js:30:42)

image

Solution

Issue is here: https://github.com/pnp/sp-dev-fx-controls-react/blob/master/src/controls/dynamicForm/DynamicForm.tsx#L624

In my opinion, it should follow the same checks as the TaxonomyFieldMulti at L593, which does contain the null check: https://github.com/pnp/sp-dev-fx-controls-react/blob/master/src/controls/dynamicForm/DynamicForm.tsx#L593

I'm not that familiar with working on public repos, so if anyone would want to create a PR, that would be great :) Thanks in advance!

Perneel avatar Oct 02 '23 17:10 Perneel

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Oct 02 '23 17:10 ghost