Skip to content

Commit

Permalink
fix(libs/form-context): make selectors safer (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpierre74 authored Feb 25, 2022
1 parent a078351 commit 39fc91c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/form-context/src/lib/forms.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const defaultData = {} as FieldValues;
export const getFormData = (formId: string) => (state: DefaultFormState) => state?.[formId]?.data || defaultData;

export const getCurrentStepIndex = (formId: string) => (state: DefaultFormState) =>
state?.[formId].currentStepIndex || 0;
state?.[formId]?.currentStepIndex || 0;

export const isLastStep = (formId: string) => (state: DefaultFormState) => {
const value = state[formId]?.isLastStep;
const value = state?.[formId]?.isLastStep;
if (typeof value === 'boolean') {
return value;
}
Expand Down

0 comments on commit 39fc91c

Please sign in to comment.