{ "name": "change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence", "cli": "nx", "version": "21.0.0-beta.5", "requires": { "@ngrx/store": ">=16.0.0" }, "description": "Change the data persistence operator imports to '@ngrx/router-store/data-persistence'.", "factory": "./src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence", "implementation": "/packages/angular/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.ts", "aliases": [], "hidden": false, "path": "/packages/angular", "schema": null, "type": "migration", "examplesFile": "#### Change the Data Persistence Operator Imports from `@nx/angular` to `@ngrx/router-store/data-persistence`\n\nThe data persistence operators (`fetch`, `navigation`, `optimisticUpdate`, and `pessimisticUpdate`) have been deprecated for a while and are now removed from the `@nx/angular` package. This migration automatically updates your import statements to use the `@ngrx/router-store/data-persistence` module and adds `@ngrx/router-store` to your dependencies if needed.\n\n#### Examples\n\nIf you import only data persistence operators from `@nx/angular`, the migration will update the import path to `@ngrx/router-store/data-persistence`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2] %}\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { fetch } from '@nx/angular';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2] %}\nimport { Injectable } from '@angular/core';\nimport { fetch } from '@ngrx/router-store/data-persistence';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nIf you import multiple data persistence operators from `@nx/angular`, the migration will update the import path for all of them.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2] %}\nimport { Injectable } from '@angular/core';\nimport { fetch, navigation } from '@nx/angular';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2] %}\nimport { Injectable } from '@angular/core';\nimport { fetch, navigation } from '@ngrx/router-store/data-persistence';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n\n{% /tab %}\n{% /tabs %}\n\nIf your imports mix data persistence operators with other utilities from `@nx/angular`, the migration will split them into separate import statements.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2] %}\nimport { Injectable } from '@angular/core';\nimport { fetch, someExtraUtility, navigation } from '@nx/angular';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/src/app/users/users.effects.ts\" highlightLines=[2,3] %}\nimport { Injectable } from '@angular/core';\nimport { fetch, navigation } from '@ngrx/router-store/data-persistence';\nimport { someExtraUtility } from '@nx/angular';\n\n@Injectable()\nexport class UsersEffects {\n // ...\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nIf you don't already have `@ngrx/router-store` in your dependencies, the migration will add it to your package.json.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```jsonc {% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@nx/angular\": \"^21.0.0\",\n \"@ngrx/store\": \"^19.1.0\",\n \"@ngrx/effects\": \"^19.1.0\"\n // ...\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```jsonc {% fileName=\"package.json\" highlightLines=[6] %}\n{\n \"dependencies\": {\n \"@nx/angular\": \"^21.0.0\",\n \"@ngrx/store\": \"^19.1.0\",\n \"@ngrx/effects\": \"^19.1.0\",\n \"@ngrx/router-store\": \"^19.1.0\"\n // ...\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" }