From 61cf3c00a22bab46f20f22f13d6838c0a10f4753 Mon Sep 17 00:00:00 2001 From: Nattaphong Klinjan Date: Wed, 15 Nov 2023 09:59:45 +0100 Subject: [PATCH] Oppdatere syntheticUserFnr til named export, ignore useEffects exhaustive-deps --- src/__mocks__/handlers/frontend/dokumenter.ts | 2 +- src/__mocks__/handlers/frontend/index.ts | 4 ++-- src/__mocks__/handlers/frontend/syntheticUserFnr.ts | 2 +- .../document-action-buttons/DocumentActionButtons.tsx | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/__mocks__/handlers/frontend/dokumenter.ts b/src/__mocks__/handlers/frontend/dokumenter.ts index 48141b0e..3ff151ce 100644 --- a/src/__mocks__/handlers/frontend/dokumenter.ts +++ b/src/__mocks__/handlers/frontend/dokumenter.ts @@ -1,6 +1,6 @@ import { faker } from "@faker-js/faker"; import { Journalpost } from "../../../pages/api/dokumenter"; -import syntheticUserFnr from "./syntheticUserFnr"; +import { syntheticUserFnr } from "./syntheticUserFnr"; import { AvsenderMottakerIdType, Journalposttype } from "../../../saf"; export const dokumentListeResolver = (req, res, ctx) => { diff --git a/src/__mocks__/handlers/frontend/index.ts b/src/__mocks__/handlers/frontend/index.ts index 5064ea8f..88071208 100644 --- a/src/__mocks__/handlers/frontend/index.ts +++ b/src/__mocks__/handlers/frontend/index.ts @@ -1,5 +1,5 @@ import { rest } from "msw"; -import syntheticUserFnr from "./syntheticUserFnr"; +import { syntheticUserFnr } from "./syntheticUserFnr"; import { dokumentListeResolver } from "./dokumenter"; import kontoResolver from "./konto"; import soknaderResolver from "./soknader"; @@ -14,7 +14,7 @@ export const frontendHandlers = [ ctx.json({ user: { fnr: syntheticUserFnr, locale: "no" }, expires_in: 50, - }) + }), ); }), rest.get(api("/dokumenter"), dokumentListeResolver), diff --git a/src/__mocks__/handlers/frontend/syntheticUserFnr.ts b/src/__mocks__/handlers/frontend/syntheticUserFnr.ts index 9a6e0dca..a325514d 100644 --- a/src/__mocks__/handlers/frontend/syntheticUserFnr.ts +++ b/src/__mocks__/handlers/frontend/syntheticUserFnr.ts @@ -1 +1 @@ -export default "1234"; +export const syntheticUserFnr = "1234"; diff --git a/src/components/document-action-buttons/DocumentActionButtons.tsx b/src/components/document-action-buttons/DocumentActionButtons.tsx index e51b522c..da4ed9fe 100644 --- a/src/components/document-action-buttons/DocumentActionButtons.tsx +++ b/src/components/document-action-buttons/DocumentActionButtons.tsx @@ -42,11 +42,12 @@ export function DocumentActionButtons(props: IProps) { logPreviewOpened(); } else if (opened.current) { const previewTimestamp = Math.round( - (+new Date() - opened.current) / 1000 + (+new Date() - opened.current) / 1000, ); opened.current = null; logDocumentPreviewClosed(previewTimestamp); } + // eslint-disable-next-line }, [modalIsOpen, logPreviewOpened, logDocumentDownloaded]); function handleDownload() {