Skip to content

Commit f3efdcf

Browse files
committed
Updating the example's ts logic
Added an explicit if (!instance) return
1 parent f720e9b commit f3efdcf

File tree

1 file changed

+3
-1
lines changed
  • playground/forms/custom-toolbar-radio-button

1 file changed

+3
-1
lines changed

playground/forms/custom-toolbar-radio-button/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const item = {
88
id: "add-radio-group",
99
title: "Add Radio Group",
1010
onPress: async () => {
11+
if (!instance) return;
12+
1113
const radioWidget1 = new window.NutrientViewer.Annotations.WidgetAnnotation(
1214
{
1315
id: window.NutrientViewer.generateInstantId(),
@@ -54,7 +56,7 @@ const item = {
5456
defaultValue: "1",
5557
},
5658
);
57-
await instance!.create([radioWidget1, radioWidget2, formField]);
59+
await instance.create([radioWidget1, radioWidget2, formField]);
5860
},
5961
};
6062

0 commit comments

Comments
 (0)