From 245ee59509813008c85ec2660cdce0b0475214b9 Mon Sep 17 00:00:00 2001 From: stigus Date: Thu, 5 Oct 2023 09:46:04 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20for=20SWR=20henting=20av=20navn=20p=C3=A5?= =?UTF-8?q?=20Bostedsadresse.tsx=20#deploy-test-frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adresser/bostedsadresse/Bostedsadresse.tsx | 6 +++--- .../fagsystem/pdlf/form/partials/navn/Navn.tsx | 3 +-- .../js/src/components/ui/button/DollyTooltip.tsx | 8 +------- .../src/pages/gruppe/PersonListe/PersonListe.tsx | 2 +- .../main/js/src/service/SelectOptionsOppslag.tsx | 3 +-- .../main/js/src/utils/hooks/useGenererNavn.tsx | 15 ++++++++++----- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx index c006231fb0d..fe7ef703eed 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx @@ -25,7 +25,7 @@ import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/Datepi import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' -import {useGenererNavn} from "@/utils/hooks/useGenererNavn"; +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' interface BostedsadresseValues { formikBag: FormikProps<{}> @@ -123,7 +123,7 @@ export const BostedsadresseForm = ({ formikBag.setFieldValue(path, adresseClone) } - const {navnInfo} = useGenererNavn() + const { navnInfo, loading } = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) return ( @@ -165,7 +165,7 @@ export const BostedsadresseForm = ({ options={navnOptions} size="xlarge" placeholder={getPlaceholder(formikBag.values, `${path}.opprettCoAdresseNavn`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: Target) => setNavn(navn, `${path}.opprettCoAdresseNavn`, formikBag.setFieldValue) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx index c3b4826dd13..6c51ec5621b 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx @@ -28,8 +28,7 @@ const concatNavnMedTidligereValgt = (type, navnInfo, selectedNavn) => { if (!navnInfo) { return [] } - const formattedNavnInfo = { loading: false, value: { data: navnInfo } } - const navnOptions = SelectOptionsOppslag.formatOptions(type, formattedNavnInfo) + const navnOptions = SelectOptionsOppslag.formatOptions(type, navnInfo) .concat( selectedNavn?.map((navn) => ({ value: navn, diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx index c5f62fcb776..6cca56ac13a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx @@ -22,13 +22,7 @@ const DollyTooltip = ({ } return useExternalTooltip ? ( - + {children} diff --git a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx index c9fe475b683..edecda7baa7 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx @@ -117,7 +117,7 @@ export default function PersonListe({ dataField: 'navn', formatter: (_cell, row) => { return ( - 23 ? row.navn : null} mouseEnterDelay={0}> + 23 ? row.navn : null}> {getNavnLimited(row.navn)} ) diff --git a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx index 2498dd0683e..a176a657156 100644 --- a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx @@ -1,6 +1,5 @@ import { useAsync } from 'react-use' import { BrregstubApi, DollyApi, KrrApi, PdlforvalterApi } from '@/service/Api' -import { getGenererNavn } from '@/utils/hooks/useGenererNavn' import Api from '@/api' import * as _ from 'lodash-es' import { Person, PersonData } from '@/components/fagsystem/pdlf/PdlTypes' @@ -210,5 +209,5 @@ export const SelectOptionsOppslag = { }) return options } - } + }, } diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx index 053d79a00c9..370fff986d2 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx @@ -17,11 +17,16 @@ export const useGenererNavn = () => { return { data: data, - navnInfo: data?.map((element: any) => ({ - fornavn: element.adjektiv, - mellomnavn: element.adverb, - etternavn: element.substantiv, - })), + navnInfo: { + value: { + data: data?.map((element: any) => ({ + fornavn: element.adjektiv, + mellomnavn: element.adverb, + etternavn: element.substantiv, + })), + loading: isLoading, + }, + }, loading: isLoading, error: error, mutate: mutate,