From aadd80afd1d87b9ea69f8ff40ad3ddf98aaf8c3c Mon Sep 17 00:00:00 2001 From: henriktheboss <122083502+henriktheboss@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:31:45 +0100 Subject: [PATCH] =?UTF-8?q?Vis=20"sendt=20sms"=20n=C3=A5r=20man=20sender?= =?UTF-8?q?=20f=C3=B8rste=20melding=20(#592)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * debug test melding * marker i url at nydialog er nydialog 🐛 * prettier --------- Co-authored-by: erikb --- src/view/dialog/DialogTrad.tsx | 10 ++++++---- src/view/dialog/NyDialogForm.tsx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/view/dialog/DialogTrad.tsx b/src/view/dialog/DialogTrad.tsx index 8da2a3a7..84f72f5b 100644 --- a/src/view/dialog/DialogTrad.tsx +++ b/src/view/dialog/DialogTrad.tsx @@ -1,8 +1,8 @@ import { Loader } from '@navikt/ds-react'; import classNames from 'classnames'; -import React, { ReactNode, Suspense, useEffect, useMemo, useRef, useState } from 'react'; +import React, { ReactNode, Suspense, useEffect, useMemo, useState } from 'react'; import { Await, useLocation } from 'react-router'; -import { Navigate } from 'react-router-dom'; +import { Navigate, useSearchParams } from 'react-router-dom'; import { useRoutes } from '../../routing/routes'; import { dispatchUpdate, UpdateTypes } from '../../utils/UpdateEvent'; import { useVisAktivitet } from '../AktivitetToggleContext'; @@ -19,8 +19,8 @@ import { DialogData } from '../../utils/Typer'; import { MaybeAktivitet } from '../AktivitetProvider'; export const DialogTrad = () => { + const [searchParams] = useSearchParams(); const { lesDialog } = useDialogContext(); - const valgtDialog = useSelectedDialog(); const dialogId = valgtDialog?.id; const fnr = useFnrContext(); @@ -36,7 +36,9 @@ export const DialogTrad = () => { useEffect(() => { // Hvis det navigeres til denne siden med en state (som arg i navigate) så puttes den i context // Hvis ikke skal sistHandlingsType være INGEN (Ikke vis send bekreftelse) - if (!navigationState?.sistHandlingsType) { + if (searchParams.has('nyDialog')) { + setViewState({ sistHandlingsType: HandlingsType.nyDialog }); + } else if (!navigationState?.sistHandlingsType) { setViewState({ sistHandlingsType: HandlingsType.ingen }); } else if (navigationState.sistHandlingsType !== viewState.sistHandlingsType) { setViewState({ sistHandlingsType: navigationState.sistHandlingsType }); diff --git a/src/view/dialog/NyDialogForm.tsx b/src/view/dialog/NyDialogForm.tsx index f80308fe..2d9f684c 100644 --- a/src/view/dialog/NyDialogForm.tsx +++ b/src/view/dialog/NyDialogForm.tsx @@ -215,7 +215,7 @@ export const nyDialogAction: (fnr: string | undefined) => ActionFunction = slettKladd(null, dialog.aktivitetId); dispatchUpdate(UpdateTypes.Dialog); silentlyHentDialoger(fnr); - return redirect(`/${dialog.id}`); + return redirect(`/${dialog.id}?nyDialog`); } else { return null; }