From f09d054dc8d8bb063beadf0e2ae5fc2574b39a99 Mon Sep 17 00:00:00 2001 From: James Dinh Date: Tue, 30 Jul 2024 12:31:26 -0700 Subject: [PATCH] feat(dep-wrapper-update): update depdency wrapper logic and testing (#691) * working through logic for array fields * add logic to correct setValue * test file layout * Update depedencyWrapper.test.tsx * Update depedencyWrapper.test.tsx * Update dependencyWrapper.tsx * Update SlotField.tsx --- lib/packages/shared-types/forms.ts | 3 +- react-app/src/components/RHF/SlotField.tsx | 2 - .../src/components/RHF/dependencyWrapper.tsx | 28 +++- .../RHF/tests/depedencyWrapper.test.tsx | 137 ++++++++++++++++++ 4 files changed, 162 insertions(+), 8 deletions(-) create mode 100644 react-app/src/components/RHF/tests/depedencyWrapper.test.tsx diff --git a/lib/packages/shared-types/forms.ts b/lib/packages/shared-types/forms.ts index ea0630740a..95c9897a94 100644 --- a/lib/packages/shared-types/forms.ts +++ b/lib/packages/shared-types/forms.ts @@ -206,7 +206,8 @@ type Effects = } | { type: "setValue"; - newValue: unknown; + newValue: string | string[]; + fieldName: string; }; export interface DependencyRule { diff --git a/react-app/src/components/RHF/SlotField.tsx b/react-app/src/components/RHF/SlotField.tsx index 0fda2f0b61..c6a4e9569d 100644 --- a/react-app/src/components/RHF/SlotField.tsx +++ b/react-app/src/components/RHF/SlotField.tsx @@ -95,8 +95,6 @@ export const SlotField = ({ : a.label.localeCompare(b.label), ); - console.log("props.customSort", props?.customSort); - return (