Removed one more useMemo

This commit is contained in:
DrMint 2022-12-05 03:47:21 +01:00
parent b5b2dd07ee
commit 35fdc7af14
1 changed files with 4 additions and 8 deletions

View File

@ -43,14 +43,10 @@ const Chronicle = ({ chronicle, chapters, ...otherProps }: Props): JSX.Element =
),
});
const primaryContent = useMemo<
NonNullable<ChronicleWithTranslations["contents"]>["data"][number]["attributes"]
>(
() =>
filterHasAttributes(chronicle.contents?.data, ["attributes.translations"] as const)[0]
?.attributes,
[chronicle.contents?.data]
);
const primaryContent = chronicle.contents
? filterHasAttributes(chronicle.contents.data, ["attributes.translations"] as const)[0]
?.attributes
: undefined;
const [selectedContentTranslation, ContentLanguageSwitcher, ContentLanguageSwitcherProps] =
useSmartLanguage({