From f50e88f23a3a0372501970f5459b409ada0c702d Mon Sep 17 00:00:00 2001 From: Anna Beddow Date: Mon, 29 Jan 2024 16:38:25 +0000 Subject: [PATCH] Update naming and add comment (#10388) --- dotcom-rendering/src/components/Discussion.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/components/Discussion.tsx b/dotcom-rendering/src/components/Discussion.tsx index e134da3db4a..295b092f643 100644 --- a/dotcom-rendering/src/components/Discussion.tsx +++ b/dotcom-rendering/src/components/Discussion.tsx @@ -70,7 +70,11 @@ const commentIdFromUrl = () => { return parseInt(commentId, 10); }; -const remapFilters = ( +/** + * If a permalink is used and the threading is set to collapsed, this function remaps the threading filter to expanded. + * We do this to ensure that threads are expanded in the UI while respecting the user's local preference. + */ +const remapToValidFilters = ( filters: FilterOptions, hashCommentId: number | undefined, ) => { @@ -129,7 +133,7 @@ export const Discussion = ({ }); }, [filters, commentPage, shortUrlId]); - const validFilters = remapFilters(filters, hashCommentId); + const validFilters = remapToValidFilters(filters, hashCommentId); useEffect(() => { rememberFilters(filters);