Skip to content

Commit fcc032e

Browse files
committed
DBC22-6880: show list update indicators on first visit
Remove first-visit gating that hid Updated highlights until a browser refresh, matching the header unread count on initial navigation.
1 parent 417af85 commit fcc032e

2 files changed

Lines changed: 7 additions & 23 deletions

File tree

src/frontend/src/pages/AdvisoriesListPage.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import PollingComponent from "../Components/shared/PollingComponent";
2929
import './AdvisoriesListPage.scss';
3030

3131
export default function AdvisoriesListPage() {
32-
const isFirstVisitRef = useRef(!sessionStorage.getItem('lastAdvisoriesVisit'));
3332
document.title = 'DriveBC - Advisories';
3433

3534
// Context
@@ -117,7 +116,7 @@ const loadAdvisories = async () => {
117116

118117
const isDismissed = dismissedHighlightsRef.current.has(String(advisory.id));
119118

120-
const isUnread = !isFirstVisitRef.current &&
119+
const isUnread =
121120
advisory.last_notified_at &&
122121
!currentContext.readAdvisories.includes(
123122
advisory.id.toString() + '-' + advisory.last_notified_at.toString()
@@ -160,14 +159,7 @@ const loadAdvisories = async () => {
160159
};
161160

162161
useEffect(() => {
163-
sessionStorage.setItem(
164-
'lastAdvisoriesVisit',
165-
new Date().toISOString()
166-
);
167-
}, []);
168-
169-
useEffect(() => {
170-
if (!advisories?.length || isFirstVisitRef.current) return;
162+
if (!advisories?.length) return;
171163

172164
const initialTracked = advisories.reduce((acc, advisory) => {
173165
const isDismissed = dismissedHighlightsRef.current.has(String(advisory.id));
@@ -329,4 +321,4 @@ useEffect(() => {
329321
<Footer />
330322
</div>
331323
);
332-
}
324+
}

src/frontend/src/pages/BulletinsListPage.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import { useLocation } from "react-router-dom";
2828
import './BulletinsListPage.scss';
2929

3030
export default function BulletinsListPage() {
31-
const isFirstVisitRef = useRef(!sessionStorage.getItem('lastBulletinsVisit'));
3231
document.title = 'DriveBC - Bulletins';
3332

3433
// Context
@@ -49,7 +48,7 @@ export default function BulletinsListPage() {
4948
const dismissedHighlightsRef = useRef(
5049
new Set(JSON.parse(sessionStorage.getItem('dismissedBulletinHighlights') || '[]'))
5150
);
52-
51+
5352

5453
// States
5554
const [showLoader, setShowLoader] = useState(true);
@@ -124,7 +123,7 @@ export default function BulletinsListPage() {
124123
);
125124
}
126125

127-
const isUnread = !isFirstVisitRef.current &&
126+
const isUnread =
128127
bulletin.last_notified_at &&
129128
!currentContext.readBulletins.includes(
130129
bulletin.id.toString() + '-' + bulletin.last_notified_at.toString()
@@ -158,7 +157,7 @@ export default function BulletinsListPage() {
158157

159158
useEffect(() => {
160159
cmsContextRef.current = cmsContext;
161-
160+
162161
if (isFirstMount.current) {
163162
isFirstMount.current = false;
164163
loadBulletins();
@@ -222,13 +221,6 @@ useEffect(() => {
222221
bulletinsRef.current = bulletins;
223222
}, [bulletins]);
224223

225-
useEffect(() => {
226-
sessionStorage.setItem(
227-
'lastBulletinsVisit',
228-
new Date().toISOString()
229-
);
230-
}, []);
231-
232224
const scrollToNextHighlightedHandler = (direction) => {
233225
const offset = 58 + 48;
234226
const sortedRefs = Object.entries(bulletinRefs.current)
@@ -296,4 +288,4 @@ useEffect(() => {
296288
<Footer />
297289
</div>
298290
);
299-
}
291+
}

0 commit comments

Comments
 (0)