From 4221c182fac0faab6753d6b7e1247eca7ff22adf Mon Sep 17 00:00:00 2001 From: Evis Drenova <80707987+evisdrenova@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:06:02 -0700 Subject: [PATCH] NEOS-1248:add optional chaining to toDate() func to avoid "toDate() is not a function" errors (#2696) --- .../connections/components/ConnectionsTable/columns.tsx | 4 ++-- .../(mgmt)/[account]/jobs/[id]/components/NextRuns.tsx | 2 +- .../[account]/jobs/components/DataTable/columns.tsx | 4 ++-- .../runs/[id]/components/JobRunActivityTable/columns.tsx | 2 +- .../[id]/components/JobRunActivityTable/data-table.tsx | 2 +- .../[account]/runs/components/JobRunsTable/columns.tsx | 4 ++-- .../settings/api-keys/components/ApiKeysTable/columns.tsx | 8 ++++---- .../[account]/settings/members/components/InviteTable.tsx | 4 ++-- .../components/UserDefinedTransformersTable/columns.tsx | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/frontend/apps/web/app/(mgmt)/[account]/connections/components/ConnectionsTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/connections/components/ConnectionsTable/columns.tsx index b84ee5eb09..60dcd7a49b 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/connections/components/ConnectionsTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/connections/components/ConnectionsTable/columns.tsx @@ -87,7 +87,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('createdAt').toDate())} + {formatDateTime(row.getValue('createdAt')?.toDate())}
); @@ -105,7 +105,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('updatedAt').toDate())} + {formatDateTime(row.getValue('updatedAt')?.toDate())}
); diff --git a/frontend/apps/web/app/(mgmt)/[account]/jobs/[id]/components/NextRuns.tsx b/frontend/apps/web/app/(mgmt)/[account]/jobs/[id]/components/NextRuns.tsx index 2215a967e5..b2220a8faa 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/jobs/[id]/components/NextRuns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/jobs/[id]/components/NextRuns.tsx @@ -61,7 +61,7 @@ export default function JobNextRuns({ jobId, status }: Props): ReactElement { - {formatDateTime(r.toDate())} + {formatDateTime(r?.toDate())} diff --git a/frontend/apps/web/app/(mgmt)/[account]/jobs/components/DataTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/jobs/components/DataTable/columns.tsx index 6c5c1d732c..611d07417d 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/jobs/components/DataTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/jobs/components/DataTable/columns.tsx @@ -132,7 +132,7 @@ export function getColumns(props: GetJobsProps): ColumnDef[] { return (
- {formatDateTime(row.getValue('createdAt').toDate())} + {formatDateTime(row.getValue('createdAt')?.toDate())}
); @@ -150,7 +150,7 @@ export function getColumns(props: GetJobsProps): ColumnDef[] { return (
- {formatDateTime(row.getValue('updatedAt').toDate())} + {formatDateTime(row.getValue('updatedAt')?.toDate())}
); diff --git a/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/columns.tsx index f429d51950..329bb12917 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/columns.tsx @@ -41,7 +41,7 @@ export function getColumns(props: GetColumnsProps): ColumnDef[] { return (
- {startTime && formatDateTimeMilliseconds(startTime.toDate())} + {startTime && formatDateTimeMilliseconds(startTime?.toDate())}
); diff --git a/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/data-table.tsx b/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/data-table.tsx index 318507e4d1..f801080d74 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/data-table.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/runs/[id]/components/JobRunActivityTable/data-table.tsx @@ -216,7 +216,7 @@ function RunEventSubTable(props: RunEventSubTableProps): React.ReactElement {
{t.eventTime && - formatDateTimeMilliseconds(t.eventTime.toDate())} + formatDateTimeMilliseconds(t.eventTime?.toDate())}
diff --git a/frontend/apps/web/app/(mgmt)/[account]/runs/components/JobRunsTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/runs/components/JobRunsTable/columns.tsx index 1876601135..3a84a4911b 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/runs/components/JobRunsTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/runs/components/JobRunsTable/columns.tsx @@ -100,7 +100,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('startedAt').toDate())} + {formatDateTime(row.getValue('startedAt')?.toDate())}
); @@ -116,7 +116,7 @@ export function getColumns( ), cell: ({ row }) => { const completedAt = row.getValue('completedAt') - ? formatDateTime(row.getValue('completedAt').toDate()) + ? formatDateTime(row.getValue('completedAt')?.toDate()) : undefined; return (
diff --git a/frontend/apps/web/app/(mgmt)/[account]/settings/api-keys/components/ApiKeysTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/settings/api-keys/components/ApiKeysTable/columns.tsx index 9216bf0e7f..a4eb04ccf3 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/settings/api-keys/components/ApiKeysTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/settings/api-keys/components/ApiKeysTable/columns.tsx @@ -63,7 +63,7 @@ export function getColumns( cell: ({ row }) => { const expiresAt = row .getValue('expiresAt') - .toDate() + ?.toDate() .getTime(); const text = expiresAt > Date.now() ? 'active' : 'expired'; const badgeVariant: BadgeProps['variant'] = @@ -87,7 +87,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('expiresAt').toDate())} + {formatDateTime(row.getValue('expiresAt')?.toDate())}
); @@ -105,7 +105,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('createdAt').toDate())} + {formatDateTime(row.getValue('createdAt')?.toDate())}
); @@ -123,7 +123,7 @@ export function getColumns( return (
- {formatDateTime(row.getValue('updatedAt').toDate())} + {formatDateTime(row.getValue('updatedAt')?.toDate())}
); diff --git a/frontend/apps/web/app/(mgmt)/[account]/settings/members/components/InviteTable.tsx b/frontend/apps/web/app/(mgmt)/[account]/settings/members/components/InviteTable.tsx index fe34cb7f6e..eb058422a7 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/settings/members/components/InviteTable.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/settings/members/components/InviteTable.tsx @@ -61,7 +61,7 @@ function getColumns( return (
- {formatDateTime(row.getValue('createdAt').toDate())} + {formatDateTime(row.getValue('createdAt')?.toDate())}
); @@ -74,7 +74,7 @@ function getColumns( return (
- {formatDateTime(row.getValue('expiresAt').toDate())} + {formatDateTime(row.getValue('expiresAt')?.toDate())}
); diff --git a/frontend/apps/web/app/(mgmt)/[account]/transformers/components/UserDefinedTransformersTable/columns.tsx b/frontend/apps/web/app/(mgmt)/[account]/transformers/components/UserDefinedTransformersTable/columns.tsx index b0a552d594..4b70a01411 100644 --- a/frontend/apps/web/app/(mgmt)/[account]/transformers/components/UserDefinedTransformersTable/columns.tsx +++ b/frontend/apps/web/app/(mgmt)/[account]/transformers/components/UserDefinedTransformersTable/columns.tsx @@ -89,7 +89,7 @@ export function getUserDefinedTransformerColumns(
{row.original.createdAt && - formatDateTime(row.getValue('createdAt').toDate())} + formatDateTime(row.getValue('createdAt')?.toDate())}
); @@ -108,7 +108,7 @@ export function getUserDefinedTransformerColumns(
{row.original.updatedAt && - formatDateTime(row.getValue('updatedAt').toDate())} + formatDateTime(row.getValue('updatedAt')?.toDate())}
);