Skip to content

Conversation

@piratefinn
Copy link
Contributor

Summary of Objectives

For some context, recently a branch was created by km where he went ham with Claude Code to deal with a lot of major things. However, the workload is a monster and we wanted human review and touch on it all. Therefore, the work is being split into 6 parts:

Title Scope
Foundation & Cleanup RxJS 7 Migration, Code Cleanup, Service Worker Gating, Tooling Updates.
Core Architecture Backend Abstraction Layer (Interfaces & Implementation).
UI Modernization Virtual Scroll Table (Replace Canvas), Theme System (Service & Vars), Mobile Responsiveness.
Email Hosting Feature New Email Hosting Module.
Angular 17 & MDC Upgrade Angular 17 Core, Material 17 Upgrade, MDC Migration (Heavy CSS).
Angular 19 Finalization Angular 18 & 19 Upgrade, provideHttpClient, Build System Update, standalone: false.

This is an incredibly terse summary of the plan and the scope of each but splitting it into six steps should make it tolerable to review. By taking the work from km's branch (after I made my own fixes so it passes tests etc.), I am systematically going through each aspect and documenting the changes so we can see what is occurring.

This is the first part of it and the changes made have been described below for a summary, including justifications. No tests additionally break compared to master (I tried fixing them more up but failed and left the effort for later, seeing it as wasted effort after hours of failing). The software itself compiles totally fine and the console is not screaming any additional errors in the browser console while looking at the end rendered product.

Detailed Modifications and Justifications

1. RxJS 7 Migration

  • Changes:
    • Replaced 105 instances of the deprecated .toPromise() method with firstValueFrom and lastValueFrom across 27 files.
    • Removed the rxjs-compat package from package.json.
  • Justification:
    • firstValueFrom and lastValueFrom explicitly convey intent and offer improved error handling.
    • Ensures future compatibility with RxJS 8 and beyond.
    • Eliminates an unnecessary compatibility dependency.

2. Tooling Updates

  • Changes:
    • Added @typescript-eslint/semi (error level) and @typescript-eslint/no-unused-vars (warn level, ignoring underscore-prefixed identifiers) rules to .eslintrc.json.
    • Disabled @typescript-eslint/member-ordering.
    • Applied automatic lint fixes (npm run lint -- --fix) to 31 files, addressing:
      • Missing semicolons.
      • Trailing whitespace in license headers.
      • Addition of Angular lifecycle interfaces (OnInit, OnChanges, DoBootstrap) to component classes and their respective imports.
      • SCSS formatting for readability.
  • Justification:
    • Enforces consistent code style and improves code quality by identifying unused variables.
    • Aligns with Angular best practices for lifecycle management.
    • Enhances code maintainability through automated formatting and type-aware linting.

3. Service Worker Gating

  • Changes:
    • Modified the Service Worker registration strategy in src/app/app.module.ts from registerWithDelay:5000 to registerWhenStable:30000.
  • Justification:
    • Improves application stability by delaying Service Worker registration until Angular's change detection has settled, preventing race conditions and ensuring a fully initialized application for the user.
    • Reduces potential errors from premature Service Worker activation.

4. Code Cleanup

  • Changes:
    • src/app/folder/folderlist.component.ts:
      • Implemented OnDestroy lifecycle hook with private destroy$ = new Subject<void>(); and takeUntil(this.destroy$) for proper subscription cleanup (expansionModel.changed and folders subscriptions).
      • Added subscription cleanup in ngOnChanges() to prevent stacking.
      • Introduced null safety to DOM removal (document.getElementById('thedragcanvas')?.remove();).
      • Explicitly marked component with standalone: false.
      • Reverted MatLegacyDialog to MatDialog.
      • Used string literal for 'Inbox' instead of a constant import.
      • Added missing semicolons and proper RxJS imports.
    • src/app/http/progress.service.ts:
      • Added a httpRequestInProgress$: Observable<boolean> = this.httpRequestInProgress.pipe(delay(0)); to prevent ExpressionChangedAfterItHasBeenCheckedError in templates.
  • Justification:
    • Prevents ExpressionChangedAfterItHasBeenCheckedError by ensuring proper change detection timing and subscription management.
    • Addresses potential memory leaks through explicit OnDestroy implementation and takeUntil.
    • Improves code maintainability, clarity, and runtime safety with null checks and consistent styling.

5. Styling Cleanup

  • Changes:
  • Justification:
    • Reduces dependencies on local font files, simplifying deployment.
    • Improves SCSS maintainability and readability by simplifying selector formatting.
    • Confirms consistent spacing values across the application.

Testing Information

  • TypeScript compilation: All changes compile successfully without errors.
  • Angular compatibility: All implementations are compatible with Angular 16.
  • Linting: Automatic lint fixes applied; further manual verification of new rules applied to new code.
  • Production readiness: Service Worker remains disabled in development environments.

@piratefinn piratefinn closed this Jan 28, 2026
@piratefinn piratefinn deleted the shadow-dot-cat/piratefinn/FE-01-Foundation-and-Cleanup branch January 28, 2026 21:57
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