Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/ui/src/form/Checklist/Checklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ export interface ChecklistContextProps {
export const ChecklistContext = createContext<ChecklistContextProps | undefined>(undefined);

export const Checklist: FunctionComponent<ChecklistProps> = ({
defaultSelectedItemId,
name,
onSelect = noop,
...props
}) => {
const { setFieldValue } = useFormikContext();

useEffect(() => {
if (defaultSelectedItemId) {
void setFieldValue(name, defaultSelectedItemId);
}
Comment thread
bc-maxy marked this conversation as resolved.

return () => {
void setFieldValue(name, '');
};
Expand All @@ -55,6 +60,7 @@ export const Checklist: FunctionComponent<ChecklistProps> = ({
<Accordion
{...props}
className="form-checklist optimizedCheckout-form-checklist"
defaultSelectedItemId={defaultSelectedItemId}
onSelect={handleSelect}
/>
</ChecklistContext.Provider>
Expand Down