Skip to content

Commit ff885ef

Browse files
committed
Hide internal topics by default when no preference exists (closes #1073)
1 parent 46e1536 commit ff885ef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

frontend/src/components/Topics/List/ListPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ const ListPage: React.FC = () => {
2222
if (!searchParams.has('perPage')) {
2323
searchParams.set('perPage', String(PER_PAGE));
2424
}
25-
if (
26-
!!localStorage.getItem('hideInternalTopics') &&
27-
!searchParams.has('hideInternal')
28-
) {
29-
searchParams.set('hideInternal', 'true');
25+
// If URL doesn't specify it, derive from localStorage (default = true when missing)
26+
if (!searchParams.has('hideInternal')) {
27+
const stored = localStorage.getItem('hideInternalTopics');
28+
const shouldHide = stored === null ? true : stored === 'true';
29+
searchParams.set('hideInternal', String(shouldHide));
30+
// persist the default so it sticks across pages
31+
if (stored === null) localStorage.setItem('hideInternalTopics', 'true');
3032
}
3133
setSearchParams(searchParams);
3234
}, []);

0 commit comments

Comments
 (0)