Skip to content

Commit

Permalink
fix: get choice lookup when question is removed (#3190)
Browse files Browse the repository at this point in the history
fix get choice lookup
  • Loading branch information
timarney authored Jan 30, 2024
1 parent 9fd7965 commit f3a79ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/form-builder/store/useTemplateStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const createTemplateStore = (initProps?: Partial<InitialTemplateStoreProps>) =>
}),
getChoice: (elId, choiceIndex) => {
const elIndex = get().form.elements.findIndex((el) => el.id === elId);
return get().form.elements[elIndex].properties.choices?.[choiceIndex];
return get().form.elements[elIndex]?.properties.choices?.[choiceIndex];
},
duplicateElement: (itemId) => {
const elIndex = get().form.elements.findIndex((el) => el.id === itemId);
Expand Down

0 comments on commit f3a79ad

Please sign in to comment.