Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(store): add createFeatureSelector migration #3214

Merged
merged 2 commits into from
Nov 3, 2021

Conversation

timdeschryver
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Adds a migration to update the deprecated createFeatureSelector syntax:

// BEFORE:

import {createFeatureSelector} from '@ngrx/store'

const featureSelector1 = createFeatureSelector('feature1');
const featureSelector2 = createFeatureSelector<Feature>(feature2);
const featureSelector3 = createFeatureSelector<State, Feature>('feature3');
const featureSelector4 = createFeatureSelector<State,Feature>(feature4);
const featureSelector5 = createFeatureSelector<State,Feature,SomethingElse>(feature5);

// AFTER:

import {createFeatureSelector} from '@ngrx/store'

const featureSelector1 = createFeatureSelector('feature1');
const featureSelector2 = createFeatureSelector<Feature>(feature2);
const featureSelector3 = createFeatureSelector< Feature>('feature3');
const featureSelector4 = createFeatureSelector<Feature>(feature4);
const featureSelector5 = createFeatureSelector<State,Feature,SomethingElse>(feature5);

@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 30, 2021

Preview docs changes for 1d1fef8 at https://previews.ngrx.io/pr3214-1d1fef81/

@@ -15,6 +15,11 @@
"description": "The road to v8 RC",
"version": "8-rc.1",
"factory": "./8_0_0-rc/index"
},
"ngrx-store-migration-13-beta": {
Copy link
Member

Choose a reason for hiding this comment

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

Based on the previous migration names:

Suggested change
"ngrx-store-migration-13-beta": {
"ngrx-store-migration-04": {

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea... 😅
The name doesn't really matter (it's only important to run the schematic in the test).
I was thinking it would make more sense to follow the versions, instead of creating an own counter.

@brandonroberts
Copy link
Member

@timdeschryver will this handle createFeatureSelector<fromRoot.State, fromFeat.State>('feat'); also?

@timdeschryver
Copy link
Member Author

@brandonroberts that should be covered. I'll add a test later today.

@timdeschryver
Copy link
Member Author

@brandonroberts @markostanimirovic I've added the test in the last commit.

@brandonroberts brandonroberts merged commit 62334f9 into master Nov 3, 2021
@timdeschryver timdeschryver deleted the migration/createFeatureSelector branch November 3, 2021 13:36
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.

4 participants