Skip to content

Commit

Permalink
rename hook og fjernet unødvendig kopi
Browse files Browse the repository at this point in the history
  • Loading branch information
taniaholst committed Feb 6, 2024
1 parent c3d827e commit 91b44dc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ApentForInnsok } from "mulighetsrommet-api-client";
import {
ArbeidsmarkedstiltakFilterGruppe,
useArbeidsmarkedstiltakFilterUtenBrukerIKontekst,
useArbeidsmarkedstiltakFilter,
} from "@/hooks/useArbeidsmarkedstiltakFilter";
import FilterTag from "../../../components/tags/FilterTag";
import { NavEnhetTag } from "../../../components/tags/NavEnhetTag";
import { NavEnhetTag } from "@/components/tags/NavEnhetTag";
import { FilterTagsContainer } from "@/components/filtrering/FilterTagsContainer";

export function NavFilterTags() {
const [filter, setFilter] = useArbeidsmarkedstiltakFilterUtenBrukerIKontekst();
const [filter, setFilter] = useArbeidsmarkedstiltakFilter();

return (
<FilterTagsContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tag } from "@navikt/ds-react";
import {
useArbeidsmarkedstiltakFilterUtenBrukerIKontekst,
useArbeidsmarkedstiltakFilter,
useArbeidsmarkedstiltakFilterValue,
valgteEnhetsnumre,
} from "@/hooks/useArbeidsmarkedstiltakFilter";
Expand All @@ -18,7 +18,7 @@ export function NavEnhetTag({ handleClick }: Props) {
const filter = useArbeidsmarkedstiltakFilterValue();
const { data: alleEnheter } = useNavEnheter();
const enheter = valgteEnhetsnumre(filter);
const [, setFilter] = useArbeidsmarkedstiltakFilterUtenBrukerIKontekst();
const [, setFilter] = useArbeidsmarkedstiltakFilter();

if (!alleEnheter || !filter || enheter.length === 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ export function useArbeidsmarkedstiltakFilter(): [
];
}

export function useArbeidsmarkedstiltakFilterUtenBrukerIKontekst(): [
ArbeidsmarkedstiltakFilter,
(filter: ArbeidsmarkedstiltakFilter) => void,
] {
const [value, setValue] = useAtom(filterAtom);

return [
value.filter,
(filter: ArbeidsmarkedstiltakFilter) => {
setValue({ brukerIKontekst: null, filter });
},
];
}

export function useArbeidsmarkedstiltakFilterValue() {
const value = useAtomValue(filterAtom);
return value.filter;
Expand Down

0 comments on commit 91b44dc

Please sign in to comment.