Skip to content

Commit f211b90

Browse files
author
Omni
committed
fix: add markForCheck for OnPush segment change and remove unused reconnected$
- CaptureTabComponent: programmatic segment assignment via captureTabService now calls markForCheck() to ensure OnPush change detection picks up the new value - NetworkService: remove reconnected$ observable (unused dead code)
1 parent bf2fad9 commit f211b90

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/app/features/home/capture-tab/capture-tab.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ export class CaptureTabComponent implements OnInit {
180180
private initSegmentListener() {
181181
this.captureTabService.segment$
182182
.pipe(
183-
tap(segment => (this.segment = segment)),
183+
tap(segment => {
184+
this.segment = segment;
185+
this.changeDetectorRef.markForCheck();
186+
}),
184187
untilDestroyed(this)
185188
)
186189
.subscribe();

src/app/shared/network/network.service.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Inject, Injectable, NgZone } from '@angular/core';
22
import { ConnectionStatus, NetworkPlugin } from '@capacitor/network';
33
import { defer, merge, ReplaySubject } from 'rxjs';
4-
import { distinctUntilChanged, filter, pairwise, pluck } from 'rxjs/operators';
4+
import { distinctUntilChanged, pluck } from 'rxjs/operators';
55
import { NETOWRK_PLUGIN } from '../capacitor-plugins/capacitor-plugins.module';
66

77
@Injectable({
@@ -15,15 +15,6 @@ export class NetworkService {
1515
this.status$
1616
).pipe(pluck('connected'), distinctUntilChanged());
1717

18-
/**
19-
* Emits when connectivity is restored (transitions from disconnected to connected).
20-
* Can be used to trigger automatic upload recovery after a network outage.
21-
*/
22-
readonly reconnected$ = this.connected$.pipe(
23-
pairwise(),
24-
filter(([prev, curr]) => !prev && curr)
25-
);
26-
2718
constructor(
2819
@Inject(NETOWRK_PLUGIN)
2920
private readonly networkPlugin: NetworkPlugin,

0 commit comments

Comments
 (0)