From 2a2e0a325ab0edc4ac49faf820fb5147df2da2a4 Mon Sep 17 00:00:00 2001 From: Jeff Clay <91073628+jeff-clay@users.noreply.github.com> Date: Mon, 30 Nov 2026 11:00:07 -0800 Subject: [PATCH 1/2] Build the goal ready card's option key without hyphens Co-Authored-By: Claude Opus 5.5 --- .../NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx | 6 +++--- .../NewStaffGoalReadyCard/NewStaffGoalReadyCard.tsx | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx index 7e5f0d904..0d385b2b0 100644 --- a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx +++ b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx @@ -24,7 +24,7 @@ import { const accountListId = 'account-list-1'; const goalId = 'goal-1'; -const optionKey = `new_staff_goal_acknowledged_${goalId}`; +const optionKey = 'new_staff_goal_acknowledged_goal_1'; const sentFigures = { monthlyGoal: 4602.66, specialNeedsTotal: 2500 }; const router = { @@ -55,7 +55,7 @@ const userOptionByKey = ( if (args.key === 'user_type_verified') { return { key: args.key, value: userGroupVerified ? 'true' : 'false' }; } - if (acknowledged === null) { + if (acknowledged === null || args.key !== optionKey) { return null; } return { @@ -273,7 +273,7 @@ describe('NewStaffGoalReadyCard', () => { expect(queryByRole('heading')).not.toBeInTheDocument(); }); - it('dismissing saves the current figures and hides the card', async () => { + it('dismissing saves the current figures under a key the API accepts and hides the card', async () => { const { findByRole, queryByRole } = render(); userEvent.click(await findByRole('button', { name: 'Dismiss' })); diff --git a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.tsx b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.tsx index fae48f0ff..0999fdc97 100644 --- a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.tsx +++ b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.tsx @@ -96,7 +96,8 @@ interface SentGoalCardProps { const SentGoalCard: React.FC = ({ accountListId, goal }) => { const { t } = useTranslation(); - const optionKey = `new_staff_goal_acknowledged_${goal.id}`; + // The API only accepts letters, numbers and underscores in option keys, and goal ids are UUIDs. + const optionKey = `new_staff_goal_acknowledged_${goal.id.replace(/[^A-Za-z0-9_]/g, '_')}`; // Read the option from the query directly; useUserPreference applies it a frame late and flashes the card. const { data } = useUserOptionQuery({ variables: { key: optionKey } }); const [updateUserOption] = useUpdateUserOptionMutation(); From 9acdf98fe1ebef27f01dff34df6fd05032f9cf53 Mon Sep 17 00:00:00 2001 From: Jeff Clay <91073628+jeff-clay@users.noreply.github.com> Date: Mon, 30 Nov 2026 11:15:43 -0800 Subject: [PATCH 2/2] Test the card key with a multi-hyphen goal id Co-Authored-By: Claude Opus 5.5 --- .../NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx index 0d385b2b0..ab620a022 100644 --- a/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx +++ b/src/components/Dashboard/NewStaffGoalReadyCard/NewStaffGoalReadyCard.test.tsx @@ -23,8 +23,8 @@ import { } from './NewStaffGoalReadyCard.generated'; const accountListId = 'account-list-1'; -const goalId = 'goal-1'; -const optionKey = 'new_staff_goal_acknowledged_goal_1'; +const goalId = 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f'; +const optionKey = 'new_staff_goal_acknowledged_a1b2c3d4_e5f6_4a7b_8c9d_0e1f'; const sentFigures = { monthlyGoal: 4602.66, specialNeedsTotal: 2500 }; const router = {