From 8810b588defe932a9b3cc6047c1361a510459b68 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 7 Oct 2024 00:48:03 -0400 Subject: [PATCH] Add TODOs for updating state with generic types on change events --- src/components/ui/dashboard/dynamic-api-select.tsx | 1 - src/components/ui/dashboard/join-coaching-session.tsx | 7 ++++--- src/lib/stores/app-state-store.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ui/dashboard/dynamic-api-select.tsx b/src/components/ui/dashboard/dynamic-api-select.tsx index 2936755..72ea71e 100644 --- a/src/components/ui/dashboard/dynamic-api-select.tsx +++ b/src/components/ui/dashboard/dynamic-api-select.tsx @@ -50,7 +50,6 @@ export function DynamicApiSelect({ isLoading, error, } = useApiData>(url, { method, params }); - const [value, setValue] = useState(""); const handleValueChange = (newValue: string) => { diff --git a/src/components/ui/dashboard/join-coaching-session.tsx b/src/components/ui/dashboard/join-coaching-session.tsx index 611354e..ac164ae 100644 --- a/src/components/ui/dashboard/join-coaching-session.tsx +++ b/src/components/ui/dashboard/join-coaching-session.tsx @@ -46,17 +46,18 @@ export function JoinCoachingSession({ setCoachingSessionId: state.setCoachingSessionId })); + // TODO: pass Organization type const handleOrganizationSelection = (value: string) => { setOrganizationId(value); - setRelationshipId; - setCoachingSessionId; } + // TODO: pass Relationship type const handleRelationshipSelection = (value: string) => { setRelationshipId(value); setCoachingSessionId; } + // TODO: pass CoachingSession type const handleSessionSelection = (value: string) => { setCoachingSessionId(value); } @@ -76,7 +77,7 @@ export function JoinCoachingSession({ onChange={handleOrganizationSelection} placeholder="Select an organization" getOptionLabel={(org) => org.name} - getOptionValue={(org) => org.id} // FIXME: this doesn't seem to display the currently selected organization when the page loads and the org.id is set + getOptionValue={(org) => org.id} elementId="organization-selector" /> diff --git a/src/lib/stores/app-state-store.ts b/src/lib/stores/app-state-store.ts index 8ed892e..f1982a8 100644 --- a/src/lib/stores/app-state-store.ts +++ b/src/lib/stores/app-state-store.ts @@ -20,7 +20,7 @@ interface AppState { coachingRelationship: CoachingRelationshipWithUserNames; } -interface AppStateActions { +export interface AppStateActions { setOrganizationId: (organizationId: Id) => void; setRelationshipId: (relationshipId: Id) => void; setCoachingSessionId: (coachingSessionId: Id) => void;