Skip to content

Commit e78443c

Browse files
Paolo PialorsiAJIXuMuK
authored andcommitted
Improved code quality for DynamicForm support of Document Sets
1 parent 0909505 commit e78443c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
240240
else {
241241

242242
// Otherwise, depending on the content type ID of the item, if any, we need to behave accordingly
243-
if (!contentTypeId || !contentTypeId.startsWith('0x0120')) {
243+
if (contentTypeId === undefined || contentTypeId === '' || !contentTypeId.startsWith('0x0120')) {
244244
// We are adding a new list item
245245
try {
246246
const iar = await sp.web.lists.getById(listId).items.add(objects);
@@ -254,7 +254,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
254254
}
255255
console.log("Error", error);
256256
}
257-
} else if (contentTypeId.startsWith('0x0120')) {
257+
} else if (contentTypeId !== undefined && contentTypeId !== '' && contentTypeId.startsWith('0x0120')) {
258258
// We are adding a folder or a Document Set
259259
try {
260260
const library = await sp.web.lists.getById(listId);

0 commit comments

Comments
 (0)