Skip to content

Commit

Permalink
remove isDependenciesSatisfied cause its no longer be used
Browse files Browse the repository at this point in the history
  • Loading branch information
epi-qang2 committed Nov 15, 2023
1 parent b5e93b3 commit 2dd3671
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/@optimizely/forms-react/src/hooks/useElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export const useElement = (element: FormElementBase) => {
.filter(s => equals(s.elementKey, element.key))[0]?.value ?? defaultValue ?? "";
const validationResults = (formContext?.formValidations ?? [])
.filter(s => equals(s.elementKey, element.key))[0]?.results ?? [];
const isDependenciesSatisfied = (formContext?.formDependencies ?? [])
.filter(s => equals(s.elementKey, element.key))[0]?.isSatisfied ?? false;


const [elementContext, setElementContext] = useState<ElementContext>({ value } as ElementContext);
Expand Down Expand Up @@ -88,7 +86,6 @@ export const useElement = (element: FormElementBase) => {
value,
defaultValue,
validationResults,
isDependenciesSatisfied
} as ElementContext);
//update form state
dispatch({
Expand All @@ -105,14 +102,6 @@ export const useElement = (element: FormElementBase) => {
});
}

const dispatchUpdateSatifiedCondition = (isSatisfied: any) => {
dispatch({
type: ActionType.UpdateDependencies,
elementKey: element.key,
isSatisfied
});
}

const dispatchUpdateValue = (value: any) => {
dispatch({
type: ActionType.UpdateValue,
Expand Down Expand Up @@ -203,7 +192,6 @@ export const useElement = (element: FormElementBase) => {
arrClass = arrClass.filter(c => c !== failClass);
}
}
validatorClasses.current = arrClass.join(" ");

return validationResults;
}
Expand All @@ -216,8 +204,6 @@ export const useElement = (element: FormElementBase) => {
}

const checkConditions = formCondition.checkConditions(formContext?.formSubmissions as FormSubmission[]);
// dispatchUpdateSatifiedCondition(checkConditions);

if (checkConditions) {
//if isDependenciesSatisfied = true, and if SatisfiedAction = show, then show element. otherwise hide element.
return equals(conditionProps.satisfiedAction, SatisfiedActionType.Show);
Expand Down

0 comments on commit 2dd3671

Please sign in to comment.