From 2c37a9dfe9557b0d9d6e4d6bcdc13b6eb949526e Mon Sep 17 00:00:00 2001 From: combs-a Date: Wed, 10 Jul 2024 11:28:13 -0500 Subject: [PATCH 1/6] Change notifications based on webpack mode --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index cce5c1d0d88..2f06e4403cf 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -8,7 +8,7 @@ import { sortFunction } from '../../utils/utils'; import { formatUrl } from '../Router/queryString'; import type { GenericNotification } from './NotificationRenderers'; -const INITIAL_INTERVAL = 5000; +let INITIAL_INTERVAL = (process.env.NODE_ENV === 'development') ? 60000 : 5000; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({ From 9c65b9109bb0b1e0e780cf48f4f6e5c0de9437e6 Mon Sep 17 00:00:00 2001 From: combs-a Date: Wed, 10 Jul 2024 16:33:43 +0000 Subject: [PATCH 2/6] Lint code with ESLint and Prettier Triggered by 2c37a9dfe9557b0d9d6e4d6bcdc13b6eb949526e on branch refs/heads/dev-notifs --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index 2f06e4403cf..7b862092e1e 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -8,7 +8,7 @@ import { sortFunction } from '../../utils/utils'; import { formatUrl } from '../Router/queryString'; import type { GenericNotification } from './NotificationRenderers'; -let INITIAL_INTERVAL = (process.env.NODE_ENV === 'development') ? 60000 : 5000; +const INITIAL_INTERVAL = process.env.NODE_ENV === 'development' ? 60_000 : 5000; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({ From 518369c9cc6b9e08338d839247d8298faef363d5 Mon Sep 17 00:00:00 2001 From: combs-a Date: Wed, 10 Jul 2024 11:37:37 -0500 Subject: [PATCH 3/6] Change let back to const --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index 2f06e4403cf..5951b57439d 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -8,7 +8,7 @@ import { sortFunction } from '../../utils/utils'; import { formatUrl } from '../Router/queryString'; import type { GenericNotification } from './NotificationRenderers'; -let INITIAL_INTERVAL = (process.env.NODE_ENV === 'development') ? 60000 : 5000; +const INITIAL_INTERVAL = (process.env.NODE_ENV === 'development') ? 60000 : 5000; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({ From 425af04f78b8e7555cd9a1779ad7fe63562c6e8a Mon Sep 17 00:00:00 2001 From: combs-a Date: Wed, 10 Jul 2024 13:59:49 -0500 Subject: [PATCH 4/6] Use timeUnits file so linter doesn't get mad at the interval --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index 7b862092e1e..fad7bdc48f8 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -6,9 +6,10 @@ import { formatDateForBackEnd } from '../../utils/parser/dateFormat'; import type { IR, RA } from '../../utils/types'; import { sortFunction } from '../../utils/utils'; import { formatUrl } from '../Router/queryString'; +import { SECOND, MINUTE } from '../Atoms/timeUnits' import type { GenericNotification } from './NotificationRenderers'; -const INITIAL_INTERVAL = process.env.NODE_ENV === 'development' ? 60_000 : 5000; +const INITIAL_INTERVAL = process.env.NODE_ENV === 'development' ? 1 * MINUTE : 5 * SECOND; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({ From 62a96c52a25c462cdcd33e9c5cdc5ebbc5022f83 Mon Sep 17 00:00:00 2001 From: combs-a Date: Wed, 10 Jul 2024 19:03:14 +0000 Subject: [PATCH 5/6] Lint code with ESLint and Prettier Triggered by 425af04f78b8e7555cd9a1779ad7fe63562c6e8a on branch refs/heads/dev-notifs --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index fad7bdc48f8..a74504f6e10 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -5,11 +5,12 @@ import { ajax } from '../../utils/ajax'; import { formatDateForBackEnd } from '../../utils/parser/dateFormat'; import type { IR, RA } from '../../utils/types'; import { sortFunction } from '../../utils/utils'; +import { MINUTE, SECOND } from '../Atoms/timeUnits'; import { formatUrl } from '../Router/queryString'; -import { SECOND, MINUTE } from '../Atoms/timeUnits' import type { GenericNotification } from './NotificationRenderers'; -const INITIAL_INTERVAL = process.env.NODE_ENV === 'development' ? 1 * MINUTE : 5 * SECOND; +const INITIAL_INTERVAL = + process.env.NODE_ENV === 'development' ? Number(MINUTE) : 5 * SECOND; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({ From dba67cea4272757c1e82960271a64adb35230ef6 Mon Sep 17 00:00:00 2001 From: Anya <71564869+combs-a@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:58:30 -0500 Subject: [PATCH 6/6] Remove unnecessary conversion Co-authored-by: Max Patiiuk --- .../frontend/js_src/lib/components/Notifications/hooks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx index a74504f6e10..f2de3466435 100644 --- a/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx +++ b/specifyweb/frontend/js_src/lib/components/Notifications/hooks.tsx @@ -10,7 +10,7 @@ import { formatUrl } from '../Router/queryString'; import type { GenericNotification } from './NotificationRenderers'; const INITIAL_INTERVAL = - process.env.NODE_ENV === 'development' ? Number(MINUTE) : 5 * SECOND; + process.env.NODE_ENV === 'development' ? MINUTE : 5 * SECOND; const INTERVAL_MULTIPLIER = 1.1; export function useNotificationsFetch({