Skip to content

Commit 179de8d

Browse files
committed
Fix initial tracker count TickPill display
Handle undefined trackingStatus when sites are first logged. The component now provides a safe default and reactively updates when tracking status data arrives, fixing the issue where "no trackers blocked" was shown initially even when trackers were actually blocked.
1 parent 6930326 commit 179de8d

File tree

1 file changed

+7
-2
lines changed
  • special-pages/pages/new-tab/app/activity/components

1 file changed

+7
-2
lines changed

special-pages/pages/new-tab/app/activity/components/Activity.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,13 @@ function TrackerStatus({ id, trackersFound }) {
254254
const { activity } = useContext(NormalizedDataContext);
255255
const status = useComputed(() => activity.value.trackingStatus[id]);
256256
const cookiePopUpBlocked = useComputed(() => activity.value.cookiePopUpBlocked?.[id]).value;
257-
const { totalCount: totalTrackersBlocked } = status.value;
258-
257+
258+
// Provide default if trackingStatus hasn't been populated yet
259+
// This handles the case where a site is first logged but trackingStatus hasn't been updated
260+
// The component will reactively update when trackingStatus is populated via activity_onDataUpdate
261+
// or activity_onDataPatch messages
262+
const trackingStatus = status.value || { totalCount: 0, trackerCompanies: [] };
263+
const totalTrackersBlocked = trackingStatus.totalCount;
259264
const totalTrackersPillText =
260265
totalTrackersBlocked === 0
261266
? trackersFound

0 commit comments

Comments
 (0)