Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 14, 2025

Overview

This PR modernizes the frontend codebase by replacing deprecated Angular patterns with current recommended practices. The changes eliminate all deprecated API usage and improve type safety, ensuring compatibility with future Angular versions.

Changes Made

1. Migrated from SubscriptionDisposable to DestroyRef

Replaced the deprecated SubscriptionDisposable base class with Angular's modern DestroyRef pattern in 5 components/services:

  • PwaService - Service worker update management
  • AudioPlayerBaseComponent - Base class for audio player components
  • AudioPlayerComponent - Full-featured audio player with seek controls
  • SingleButtonAudioPlayerComponent - Compact audio player for checking
  • CheckingCommentsComponent - Comment display and management
  • CheckingQuestionComponent - Question display with audio support

Before:

export class PwaService extends SubscriptionDisposable {
  constructor(...) {
    super();
    interval(PWA_CHECK_FOR_UPDATES)
      .pipe(takeUntil(this.ngUnsubscribe))
      .subscribe(...);
  }
}

After:

export class PwaService {
  constructor(..., private readonly destroyRef: DestroyRef) {
    interval(PWA_CHECK_FOR_UPDATES)
      .pipe(quietTakeUntilDestroyed(this.destroyRef))
      .subscribe(...);
  }
}

2. Fixed Deprecated fromEvent Type Parameters

Updated sharedb-realtime-remote-store.ts to use type assertions instead of deprecated explicit type parameters for RxJS fromEvent:

Before:

this.changes$ = fromEvent<[any, any]>(this.doc, 'op').pipe(map(([ops]) => ops));

After:

this.changes$ = (fromEvent(this.doc, 'op') as Observable<[any, any]>).pipe(map(([ops]) => ops));

3. Updated Tests

Updated all affected test files to properly mock DestroyRef:

private readonly mockDestroyRef: DestroyRef = { onDestroy: (_cb: () => void) => () => {} };

Impact

  • Compatibility: Eliminates deprecated API usage that will be removed in future Angular versions
  • Code Quality: Reduced ESLint warnings from 250 to 237
  • Test Coverage: All 240+ tests passing with zero failures introduced
  • Build Status: Development build successful with zero TypeScript errors
  • Breaking Changes: None - full backward compatibility maintained

Why This Matters

The deprecated SubscriptionDisposable class was marked for removal as Angular now provides DestroyRef as the official way to handle component cleanup. This migration:

  1. Follows Angular's recommended patterns
  2. Prevents future breaking changes when deprecated APIs are removed
  3. Uses the more efficient takeUntilDestroyed operator
  4. Improves code maintainability by using standard Angular APIs

Testing

Verified functionality across multiple test suites:

  • PwaService: 4/4 tests passing
  • Audio components: 14/14 tests passing
  • Checking components: 222/222 tests passing

All modified components have been thoroughly tested to ensure no regressions.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4363 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-28811374 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,14683629626945241614,14049929453526293768,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-28811374 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=28811374 (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4505 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-67573815 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,15270322350340913338,14910253362746942240,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • android.clients.google.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4363 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-28811374 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,14683629626945241614,14049929453526293768,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-28811374 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=28811374 (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4656 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-74372955 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,17194858283527730254,5181093158567068736,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • cdn.auth0.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=5310 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-63836314 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,9285823493998262117,5832430567733367814,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-63836314 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=63836314 (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • clients2.google.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4363 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-28811374 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,14683629626945241614,14049929453526293768,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-28811374 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=28811374 (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4505 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-67573815 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,15270322350340913338,14910253362746942240,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • fonts.googleapis.com
    • Triggering command: ng build (dns block)
  • fonts.languagetechnology.org
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=5310 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-63836314 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,9285823493998262117,5832430567733367814,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-63836314 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=63836314 (dns block)
  • redirector.gvt1.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4363 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-28811374 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,14683629626945241614,14049929453526293768,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-28811374 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=28811374 (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4505 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-67573815 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,15270322350340913338,14910253362746942240,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • update.googleapis.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=5310 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-63836314 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,9285823493998262117,5832430567733367814,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-63836314 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=63836314 (dns block)
  • www.google-analytics.com
    • Triggering command: ng lint (dns block)
    • Triggering command: ng test --browsers xForgeChromiumHeadless --source-map --watch=false --include **/pwa.service.spec.ts (dns block)
    • Triggering command: ng test --browsers xForgeChromiumHeadless --source-map --watch=false --include **/audio-player-base.component.spec.ts --include **/audio-player.component.spec.ts (dns block)
  • www.google.com
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4363 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-28811374 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,14683629626945241614,14049929453526293768,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --user-data-dir=/tmp/karma-28811374 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --no-sandbox --disable-extensions --use-fake-device-for-media-stream --use-fake-ui-for-media-stream --autoplay-policy=no-user-gesture-required --remote-debugging-port=9988 --headless --disable-gpu --disable-dev-shm-usage --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=28811374 (dns block)
    • Triggering command: /usr/local/share/chromium/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-fake-device-for-media-stream --use-angle=swiftshader-webgl --crashpad-handler-pid=4505 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-67573815 --subproc-heap-profiling --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,15270322350340913338,14910253362746942240,262144 --disable-features=PaintHolding --variations-seed-version (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Examine the frontend client in src/SIL.XForge.Scripture/ClientApp/src/. Clean up the code. Make improvements.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


This change is Reviewable

@marksvc
Copy link
Collaborator

marksvc commented Oct 14, 2025

I will plan to check back on this, but others can make changes, review, or merge as desired.

@Copilot Copilot AI changed the title [WIP] Clean up and improve frontend client code Replace deprecated SubscriptionDisposable with DestroyRef and fix type safety issues Oct 14, 2025
@Copilot Copilot AI requested a review from marksvc October 14, 2025 18:28
Copilot finished work on behalf of marksvc October 14, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants