Skip to content

Angular upgrade to v15#570

Merged
uldisrudzitis merged 3 commits intomasterfrom
enh-angular-upgrade-to-v15
Oct 2, 2025
Merged

Angular upgrade to v15#570
uldisrudzitis merged 3 commits intomasterfrom
enh-angular-upgrade-to-v15

Conversation

@uldisrudzitis
Copy link
Copy Markdown
Collaborator

@uldisrudzitis uldisrudzitis commented Oct 2, 2025

Summary by CodeRabbit

  • New Features
    • Standardized router behavior and app base path for more predictable navigation.
  • Bug Fixes
    • Fixed navigation after section delete/rename.
    • Improved preview reload handling to prevent crashes on invalid data.
  • Chores
    • Upgraded framework and tooling (Angular 15, TypeScript 4.9) and updated Node support.
    • Updated global stylesheet location and modernized compiler targets.
  • Tests
    • Added testing bootstrap to improve unit test stability and execution.

@uldisrudzitis uldisrudzitis self-assigned this Oct 2, 2025
@uldisrudzitis uldisrudzitis added Enhancement dependencies Pull requests that update a dependency file labels Oct 2, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Angular project upgraded and reconfigured: package versions bumped (Angular 15, TypeScript 4.9), TypeScript and CLI configs adjusted, global styles path updated, test bootstrap added. Routing options updated and base href provided. Navigation logic changed to derive routes from params values. Preview service adds payload guards before iframe reload logic.

Changes

Cohort / File(s) Summary
Framework and build/test config updates
editor/package.json, editor/tsconfig.json, editor/angular.json, editor/src/test.ts
Angular deps upgraded to 15.x and TS to ~4.9.5; TS target set to ES2022 with useDefineForClassFields: false; global styles path moved to src/styles/styles.scss; added Angular/Karma test bootstrap.
Routing configuration
editor/src/app/app-routing.module.ts, editor/src/app/app.module.ts
Replaced RouterModule.forRoot options from { relativeLinkResolution: 'legacy' } to {}; added APP_BASE_HREF provider with value '/engine/'.
Navigation param handling
editor/src/app/sites/sections/section.component.ts, editor/src/app/sites/sections/site-sections.component.ts
When navigating after delete/rename, route array now built from Object.values(obj['params']) instead of passing params object directly.
Preview action guards
editor/src/app/preview/preview.service.ts
Added guards ensuring action.payload exists and is an object before extracting slug and triggering iframe reload logic.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant SectionComponent
  participant Router

  User->>SectionComponent: Delete section
  SectionComponent->>SectionComponent: Compute route = Object.values(params)
  SectionComponent->>Router: navigate(route, { queryParams, queryParamsHandling: 'merge' })
  Router-->>User: Navigation completes
Loading
sequenceDiagram
  autonumber
  participant Store as NGXS Store
  participant PreviewService
  participant Iframe as Preview Iframe

  Store-->>PreviewService: Dispatch(UpdateSiteTemplateSettingsAction { payload })
  PreviewService->>PreviewService: Validate action.payload is non-null object
  alt payload valid
    PreviewService->>PreviewService: Extract slug from payload
    PreviewService->>Iframe: Reload with updated template settings
  else payload invalid
    PreviewService-->>Store: Ignore (no reload)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A nibble of routes, a crunch of TS grain,
I hop through configs in refactored terrain.
Styles burrow deeper, tests wake with the sun,
Payloads get checked—no wild runs.
With /engine/ as home and links set aright,
I ship this upgrade—ears high, code light. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Angular upgrade to v15” accurately reflects the primary change of updating the project’s Angular version to 15 and is concise, clear, and specific without unnecessary details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enh-angular-upgrade-to-v15

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
editor/src/app/sites/sections/site-sections.component.ts (1)

255-256: Redundant Object.values() call on array.

Line 247 sets obj['params'] = ['/sections', updatedSection.name], which is already an array. Applying Object.values() to an array at line 255 returns the same array, making this transformation unnecessary.

Apply this diff to simplify:

-                const route =
-                  'params' in obj ? Object.values(obj['params']) : [];
+                const route =
+                  'params' in obj ? obj['params'] : [];

If obj['params'] could be an object in some cases, please verify and add a comment explaining the need for Object.values().

editor/src/app/sites/sections/section.component.ts (1)

255-256: Redundant Object.values() call on array.

Line 247 sets obj['params'] = ['/sections'], which is already an array. Applying Object.values() to an array at line 255 returns the same array, making this transformation unnecessary.

Apply this diff to simplify:

-                const route =
-                  'params' in obj ? Object.values(obj['params']) : [];
+                const route =
+                  'params' in obj ? obj['params'] : [];

If obj['params'] could be an object in some cases, please verify and add a comment explaining the need for Object.values().

editor/package.json (1)

18-25: Align @angular/cdk patch level with the rest of Angular.

All other Angular framework packages are pinned to 15.2.10, but @angular/cdk stays at 15.2.9. Mixing patch levels can surface hard-to-debug compatibility issues when the CDK lags behind the framework. Bump it to 15.2.10 for consistency.

-    "@angular/cdk": "^15.2.9",
+    "@angular/cdk": "^15.2.10",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 498813b and 6db26a7.

⛔ Files ignored due to path filters (1)
  • editor/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • editor/angular.json (1 hunks)
  • editor/package.json (3 hunks)
  • editor/src/app/app-routing.module.ts (1 hunks)
  • editor/src/app/app.module.ts (2 hunks)
  • editor/src/app/preview/preview.service.ts (1 hunks)
  • editor/src/app/sites/sections/section.component.ts (1 hunks)
  • editor/src/app/sites/sections/site-sections.component.ts (1 hunks)
  • editor/src/test.ts (1 hunks)
  • editor/tsconfig.json (1 hunks)
🔇 Additional comments (7)
editor/src/test.ts (1)

1-14: LGTM! Standard Angular 15 test bootstrap.

The test configuration correctly initializes the Angular testing environment with zone.js/testing, BrowserDynamicTestingModule, and platformBrowserDynamicTesting(). This is the standard pattern for Angular 15 Karma test setup.

Based on learnings: The zone.js/testing import aligns with zone.js 0.11.4 expected by Angular 15.2.10.

editor/tsconfig.json (2)

11-11: LGTM! ES2022 target aligns with Angular 15.

The TypeScript target update to ES2022 is appropriate for Angular 15 and TypeScript 4.9, enabling modern JavaScript features.


20-20: LGTM! Required for Angular + TypeScript 4.9 compatibility.

Setting useDefineForClassFields: false is necessary when using TypeScript 4.9+ with Angular to maintain backward-compatible class field initialization behavior. Without this, Angular decorators may not work correctly.

Based on learnings: This flag ensures compatibility with Angular 15.2.10 and TypeScript 4.9.

editor/src/app/preview/preview.service.ts (1)

516-525: LGTM! Defensive payload guards.

The added guards prevent potential runtime errors by verifying that action.payload exists, is an object, and is not null before accessing its properties. This defensive approach ensures the reload logic fails safely when encountering unexpected action shapes.

editor/src/app/app-routing.module.ts (1)

111-111: LGTM! Correct removal of deprecated option.

The relativeLinkResolution: 'legacy' option was deprecated and removed in Angular 15. The default behavior is now 'corrected', which is the modern standard. This change aligns the routing module with Angular 15 requirements.

editor/src/app/app.module.ts (1)

4-4: LGTM! APP_BASE_HREF configuration.

The APP_BASE_HREF provider correctly configures the base path for the application deployed at /engine/. This aligns with the baseHref: "/engine/dist/" setting in angular.json and ensures the router generates correct URLs for non-root deployments.

Also applies to: 85-85

editor/angular.json (1)

49-49: New styles path verified. The file editor/src/styles/styles.scss exists at the updated location.

@uldisrudzitis uldisrudzitis merged commit bfd0a1d into master Oct 2, 2025
3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant