Skip to content

[Feature][Medium] Performance optimizations, a11y gaps, naming typo, and architecture improvements #3402

Description

@numbers-official

Summary

Nine medium-priority improvement findings discovered during automated deep check on 2026-04-10. These are new findings not covered by existing issues.


1. Missing Zone.js Event Patching Optimizations

File: src/zone-flags.ts

Only __Zone_disable_customElements is set. High-frequency events (scroll, mousemove, touchmove, pointermove, resize) are still patched by Zone.js, each triggering change detection.

Fix: Add to zone-flags.ts:

(window as any).__zone_symbol__UNPATCHED_EVENTS = [
  'scroll', 'mousemove', 'touchmove', 'pointermove',
  'mouseenter', 'mouseleave', 'resize'
];

2. Typo: NETOWRK_PLUGIN Injection Token

Files: src/app/shared/capacitor-plugins/capacitor-plugins.module.ts, capacitor-plugins-testing.module.ts, src/app/shared/network/network.service.ts (6 references total)

Token named NETOWRK_PLUGIN instead of NETWORK_PLUGIN (transposed O/W). Hinders code searchability.

Fix: Rename to NETWORK_PLUGIN across all references.


3. PreloadAllModules Eagerly Loads All Routes

File: src/app/app-routing.module.ts line 86

Uses PreloadAllModules which downloads all ~15 lazy routes after initial load. On mobile cellular connections, this wastes bandwidth and CPU on routes the user may never visit.

Fix: Replace with custom PreloadingStrategy that only preloads routes marked with data: { preload: true }.


4. Inconsistent Platform Detection

Files:

  • src/app/shared/media/component/media.component.ts line 60 — uses Capacitor.getPlatform() == 'android' (also loose equality)
  • src/app/shared/dia-backend/notification/dia-backend-notification.service.ts line 53

Project convention (per CLAUDE.md) is to use Platform.is() from @ionic/angular.

Fix: Replace with Platform.is('android') / Platform.is('ios'). Fix == to ===.


5. CUSTOM_ELEMENTS_SCHEMA on SharedModule

Files: src/app/shared/shared.module.ts, details.module.ts, go-pro.module.ts, tutorial.module.ts

SharedModule declares CUSTOM_ELEMENTS_SCHEMA, silencing Angular template compiler for ALL unknown elements app-wide. Typos in component selectors compile without error.

Fix: Move schema to leaf-level modules that actually use Ionic web components.


6. Duplicate hasNewInbox$ Observable

Files: src/app/features/home/home.page.ts lines 71-80, src/app/features/home/capture-tab/capture-tab.component.ts lines 56-65

Identical observable with same workaround comment copy-pasted in two components. Causes duplicate API calls.

Fix: Lift to shared service with shareReplay(1).


7. No Accessibility (a11y) Attributes on Camera UI

File: src/app/features/home/custom-camera/custom-camera.page.html lines 11-143

Interactive elements (flash toggle, quality toggle, capture button, camera flip) use <div> + (click) without role="button", aria-label, or tabindex.

Fix: Add ARIA attributes, keyboard handlers, and screen reader labels.


8. Constructor-Based Subscription Initialization

Files: src/app/features/home/home.page.ts lines 111-116, src/app/features/home/capture-tab/capture-tab.component.ts lines 153-159

Constructors initiate active subscriptions (including network requests) instead of using Angular/Ionic lifecycle hooks. Causes change detection issues and makes testing difficult.

Fix: Move to ngOnInit() or ionViewDidEnter.


9. Unguarded Subscriptions in SettingsPage

File: src/app/features/settings/settings.page.ts lines 147-159, 170

.subscribe() calls without untilDestroyed(this) despite the class using @UntilDestroy({ checkProperties: true }). The subscriptions are not assigned to properties, so they escape the automatic check.

Fix: Add untilDestroyed(this) before .subscribe() for consistency.

Generated by Heart Beat with Omni

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions