We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c44fc1e commit 2dffc56Copy full SHA for 2dffc56
packages/pwa/src/pages/index.tsx
@@ -35,11 +35,15 @@ export default function Home() {
35
service.send({ type: 'TICK' });
36
});
37
38
- service.subscribe((_state, event) => {
+ const subscription = service.subscribe(((_state, event) => {
39
if (event && (event.type === 'START' || event.type === 'STOP')) {
40
intervalWorker.postMessage(event.type);
41
}
42
- });
+ }) as any);
43
+
44
+ return () => {
45
+ subscription.unsubscribe();
46
+ };
47
}, [service]);
48
49
const toggleTimer = () => {
0 commit comments