From b15769bae2d345b9cba4425d9e2fbe48c208fa8b Mon Sep 17 00:00:00 2001 From: Eric Sizer Date: Wed, 2 Oct 2024 11:18:09 -0400 Subject: [PATCH] fix errors after merging main --- apps/playwright/tests/login-logout.spec.ts | 2 +- apps/playwright/utils/roles.ts | 2 +- apps/web/src/hooks/useErrorMessages.ts | 2 +- .../ScreeningAndEvaluationPage/ScreeningAndEvaluationPage.tsx | 4 ++-- apps/web/src/utils/nameUtils.tsx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/playwright/tests/login-logout.spec.ts b/apps/playwright/tests/login-logout.spec.ts index ca8ad63c9bf..1b6b5ede2cc 100644 --- a/apps/playwright/tests/login-logout.spec.ts +++ b/apps/playwright/tests/login-logout.spec.ts @@ -55,7 +55,7 @@ test.describe("Login and logout", () => { myAuth?: { id: string }; }; }; - expect(response.data.myAuth.id).toMatch( + expect(response?.data?.myAuth?.id).toMatch( /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, ); // make sure it uses the access token diff --git a/apps/playwright/utils/roles.ts b/apps/playwright/utils/roles.ts index e1582c2f474..461fe728f3e 100644 --- a/apps/playwright/utils/roles.ts +++ b/apps/playwright/utils/roles.ts @@ -19,5 +19,5 @@ const Test_RolesQueryDocument = /* GraphQL */ ` export async function getRoles(ctx: GraphQLContext): Promise { const res = await ctx.post<{ roles: Role[] }>(Test_RolesQueryDocument); - return res.roles; + return res?.roles ?? []; } diff --git a/apps/web/src/hooks/useErrorMessages.ts b/apps/web/src/hooks/useErrorMessages.ts index 2734c534bdf..011c236dc91 100644 --- a/apps/web/src/hooks/useErrorMessages.ts +++ b/apps/web/src/hooks/useErrorMessages.ts @@ -65,7 +65,7 @@ const useErrorMessages = (): ErrorWithMessages => { if (isRouteErrorResponse(error) && "status" in error) { return { - error: new Error(error.data?.message), + error: new Error(String(error.data?.message)), messages: knownErrorMessages[error.status], }; } diff --git a/apps/web/src/pages/Pools/ScreeningAndEvaluationPage/ScreeningAndEvaluationPage.tsx b/apps/web/src/pages/Pools/ScreeningAndEvaluationPage/ScreeningAndEvaluationPage.tsx index 31289014b3a..8e71808e817 100644 --- a/apps/web/src/pages/Pools/ScreeningAndEvaluationPage/ScreeningAndEvaluationPage.tsx +++ b/apps/web/src/pages/Pools/ScreeningAndEvaluationPage/ScreeningAndEvaluationPage.tsx @@ -153,8 +153,8 @@ const ScreeningAndEvaluationPage = () => { .then((res) => { setCandidates(res); }) - .catch((err) => { - logger.error(err); + .catch((err: unknown) => { + logger.error(String(err)); }); } diff --git a/apps/web/src/utils/nameUtils.tsx b/apps/web/src/utils/nameUtils.tsx index e6938141043..961f9abce69 100644 --- a/apps/web/src/utils/nameUtils.tsx +++ b/apps/web/src/utils/nameUtils.tsx @@ -139,7 +139,7 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { "Message shown to user when the abbreviation text is not found.", }); const stringifyText = - text && nodeToString(Array.isArray(text) ? text[0] : text); + text && nodeToString(Array.isArray(text) ? (text[0] as ReactNode) : text); if (typeof stringifyText !== "string") { return (