Skip to content

Commit

Permalink
🐛 List of articles were set in wrong chipnav
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Dec 18, 2023
1 parent d797a3e commit adc36c9
Showing 1 changed file with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,25 @@ type ChipsGroupProps = { data: ChipsData; showTema: boolean };
function ChipsGroup(props: ChipsGroupProps) {
const { innholdstypeQuery, undertemaQuery } = useGpQuery();

const undertemaList = useMemo(
() =>
undertemaQuery
const list = useMemo(() => {
return {
innholdstype: innholdstypeQuery
? props.data.filter((entry) => {
return entry["undertema-title"] === undertemaQuery;
return entry["innholdstype-title"] === innholdstypeQuery;
})
: props.data,
[props.data, undertemaQuery]
);

const innholdstypeList = useMemo(
() =>
innholdstypeQuery
undertema: undertemaQuery
? props.data.filter((entry) => {
return entry["innholdstype-title"] === innholdstypeQuery;
return entry["undertema-title"] === undertemaQuery;
})
: props.data,
[props.data, innholdstypeQuery]
);
};
}, [props.data, innholdstypeQuery, undertemaQuery]);

return (
<VStack gap="4">
{props.showTema && <ChipNav type="undertema" data={undertemaList} />}
<ChipNav type="innholdstype" data={innholdstypeList} />
{props.showTema && <ChipNav type="undertema" data={list.innholdstype} />}
<ChipNav type="innholdstype" data={list.undertema} />
</VStack>
);
}
Expand Down

0 comments on commit adc36c9

Please sign in to comment.