nx icon indicating copy to clipboard operation
nx copied to clipboard

Ngrx18 migration incomplete - migration for breaking changes are not included

Open colinscz opened this issue 1 week ago • 0 comments

Current Behavior

Currently some of the ngrx dependencies are automatically updated. As introduced in this PR: https://github.com/nrwl/nx/pull/26549/files

But there are some breaking changes and new packages introduced in certain scenarios that are not yet covered by the migration. This results in the build failing because for example this import right here: import { concatLatestFrom } from '@ngrx/effects';

is not found anymore and newly reside in the other package: import { concatLatestFrom } from '@ngrx/operators';

More info here: https://ngrx.io/guide/migration/v18

Could you please add migrations for those scenarios?

I checked the open PRs and issues but I haven't found any planned change for this.

Expected Behavior

Breaking changes from Ngrx migration including changes for some code moved from @ngrx/effects to @ngrx/operators are included in the migrations.

GitHub Repo

No response

Steps to Reproduce

  1. Update from a Nx Angular workspace containing more than just the ngrx store dependency (in my case I was on Nx 17.3.2)
  2. Try to run the application after this upgrade and after all necessary migrations have been applied

Nx Report

Nx report from before the nx migrate latest command was executed since after that I already have issues with the npm install:

   Node   : 18.20.2
   OS     : win32-x64
   npm    : 10.5.0
   
   nx (global)        : 19.3.1
   nx                 : 17.3.2
   @nx/js             : 17.3.2
   @nx/jest           : 17.3.2
   @nx/linter         : 17.3.2
   @nx/eslint         : 17.3.2
   @nx/workspace      : 17.3.2
   @nx/angular        : 17.3.2
   @nx/cypress        : 17.3.2
   @nx/devkit         : 17.3.2
   @nx/eslint-plugin  : 17.3.2
   @nrwl/tao          : 17.3.2
   @nx/web            : 17.3.2
   @nx/webpack        : 17.3.2
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   @ngrx/component      : 17.0.1
   @ngrx/data           : 17.0.1
   @ngrx/effects        : 17.0.1
   @ngrx/entity         : 17.0.1
   @ngrx/router-store   : 17.0.1
   @ngrx/store          : 17.0.1
   @ngrx/store-devtools : 17.0.1
   eslint-plugin-ngrx   : 2.1.4
   nx-stylelint         : 17.1.4

Failure Logs

After the migrations to Nx 19.3.1 were run in the project

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"18.0.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^17.0.0" from @ngrx/[email protected]
npm ERR! node_modules/@ngrx/component
npm ERR!   @ngrx/component@"17.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!

// even if I fix this one manually there are more dependencies not up to date that were as far as I can remember previously 
// included in updates:

(imported as 'concatLatestFrom') was not found in '@ngrx/effects' ([39m[22m[1m[31mpossible exports: Actions, EFFECTS_ERROR_HANDLER, EffectSources, EffectsFeatureModule, EffectsModule, EffectsRootModule, EffectsRunner, ROOT_EFFECTS_INIT, USER_PROVIDED_EFFECTS, act, createEffect, defaultEffectsErrorHandler, getEffectsMetadata, mergeEffects, ofType, provideEffects, rootEffectsInit)

[91merror[0m[90m TS2305: [0mModule '"@ngrx/effects"' has no exported member 'concatLatestFrom'.[39m[22m
[1m[31m[39m[22m
[1m[31m[7m5[0m import {Actions, concatLatestFrom, createEffect, ofType} from '@ngrx/effects';[39m[22m

Package Manager Version

No response

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

Unfortunately I cannot provide an exact repo and nx-examples does not use ngrx-store and related packages to that extend.

But happy to help in case I can assist with any additional information.

colinscz avatar Jun 26 '24 12:06 colinscz