Skip to content

Commit 853472e

Browse files
committed
address feedback
1 parent 8f8cfbd commit 853472e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/entries/worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
*/
44
import { run } from '../sw/serviceWorker/ServiceWorker';
55

6-
// The run() is already called in ServiceWorker.ts, but importing it ensures it's not tree-shaken
7-
void run;
6+
// Need to call run() to ensure the service worker is registered but also to ensure the service worker is not tree-shaken
7+
run();

src/shared/services/limitStore.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
LimitStore.put('colorado', 'rocky');
2+
limitStorePut('colorado', 'rocky');
33
["rocky"]
4-
LimitStore.put('colorado', 'mountain');
4+
limitStorePut('colorado', 'mountain');
55
["rocky", "mountain"]
6-
LimitStore.put('colorado', 'national');
6+
limitStorePut('colorado', 'national');
77
["mountain", "national"]
8-
LimitStore.put('colorado', 'park');
8+
limitStorePut('colorado', 'park');
99
["national", "park"]
1010
*/
1111
const LIMIT = 2;
@@ -16,7 +16,7 @@ export function limitStorePut<T>(key: string, value: T) {
1616
store[key] = [null, null];
1717
}
1818
store[key].push(value);
19-
if (store[key].length == LIMIT + 1) {
19+
if (store[key].length === LIMIT + 1) {
2020
store[key].shift();
2121
}
2222
return store[key];

src/sw/serviceWorker/ServiceWorker.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import type {
3131
UpsertOrDeactivateSessionPayload,
3232
} from 'src/shared/session/types';
3333
import { NotificationType } from 'src/shared/subscriptions/constants';
34-
import { getAppId } from './ServiceWorker';
34+
import { getAppId, run } from './ServiceWorker';
3535

3636
// Mock webhook notification events
3737
vi.mock('../webhooks/notifications/webhookNotificationEvent', () => ({
@@ -53,6 +53,8 @@ const appId = APP_ID;
5353
const notificationId = 'test-notification-id';
5454
const version = __VERSION__;
5555

56+
run();
57+
5658
vi.useFakeTimers();
5759
vi.setSystemTime('2025-01-01T00:08:00.000Z');
5860
vi.spyOn(Log, '_debug').mockImplementation(() => {});

src/sw/serviceWorker/ServiceWorker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,5 +1111,3 @@ function parseOrFetchNotifications(
11111111
`Unexpected push message payload received: ${event.data}`,
11121112
);
11131113
}
1114-
1115-
run();

0 commit comments

Comments
 (0)