Skip to content

Commit

Permalink
Merge pull request #1 from ngrx/master
Browse files Browse the repository at this point in the history
Latest Version
  • Loading branch information
phillipzada authored Sep 19, 2017
2 parents 6c419f8 + c31573f commit 90901e3
Show file tree
Hide file tree
Showing 111 changed files with 5,639 additions and 736 deletions.
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- ❤️ ngrx? Please consider supporting our collective: 👉 [donate](https://opencollective.com/ngrx/donate) -->

## I'm submitting a...
<!-- Check one of the following options with "x" -->
Expand All @@ -6,11 +7,10 @@
[ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
</code></pre>

## What is the current behavior?
<!-- Describe what the current behavior would is. -->
<!-- Describe the current behavior. -->

## Expected behavior:
<!-- Describe what the desired behavior would be. -->
Expand All @@ -27,5 +27,3 @@ http://plnkr.co/edit/tpl:757r6L
## Other information:



:heartpulse: ngrx? Please consider supporting our collective: 👉 [donate](https://opencollective.com/ngrx/donate)
115 changes: 5 additions & 110 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,6 @@
<a name="4.0.0"></a>
# [4.0.0](https://github.com/ngrx/platform/compare/v4.0.1...v4.0.0) (2017-07-22)


### Bug Fixes

* **docs:** update angular-cli variable ([eeb7d5d](https://github.com/ngrx/platform/commit/eeb7d5d))
* **Effects:** Wrap testing source in an Actions observable (#121) ([bfdb83b](https://github.com/ngrx/platform/commit/bfdb83b)), closes [#117](https://github.com/ngrx/platform/issues/117)
* **Store:** Remove auto-memoization of selector functions ([90899f7](https://github.com/ngrx/platform/commit/90899f7)), closes [#118](https://github.com/ngrx/platform/issues/118)


### Features

* **Effects:** Add generic type to the "ofType" operator ([55c13b2](https://github.com/ngrx/platform/commit/55c13b2))
* **Store:** Added initial state function support for features. Added more tests (#85) ([5e5d7dd](https://github.com/ngrx/platform/commit/5e5d7dd))



<a name="4.0.1"></a>
## [4.0.1](https://github.com/ngrx/platform/compare/v4.0.0...v4.0.1) (2017-07-18)


### Bug Fixes

* **effects:** allow downleveled annotations (#98) ([875b326](https://github.com/ngrx/platform/commit/875b326)), closes [#93](https://github.com/ngrx/platform/issues/93)
* **effects:** make correct export path for testing module (#96) ([a5aad22](https://github.com/ngrx/platform/commit/a5aad22)), closes [#94](https://github.com/ngrx/platform/issues/94)



<a name="4.0.0"></a>
# [4.0.0](https://github.com/ngrx/platform/compare/68bd9df...v4.0.0) (2017-07-18)


### Bug Fixes

* **build:** Fixed deployment of latest master as commit (#18) ([5d0ecf9](https://github.com/ngrx/platform/commit/5d0ecf9)), closes [#18](https://github.com/ngrx/platform/issues/18)
* **build:** Get tests running for each project ([c4a1054](https://github.com/ngrx/platform/commit/c4a1054))
* **build:** Limit concurrency for lerna bootstrap ([7e7a7d8](https://github.com/ngrx/platform/commit/7e7a7d8))
* **Devtools:** Removed SHOULD_INSTRUMENT token used to eagerly inject providers (#57) ([b90df34](https://github.com/ngrx/platform/commit/b90df34))
* **Effects:** Start child effects after running root effects (#43) ([931adb1](https://github.com/ngrx/platform/commit/931adb1))
* **Effects:** Use Actions generic type for the return of the ofType operator ([d176a11](https://github.com/ngrx/platform/commit/d176a11))
* **Example:** Fix Book State interface parent (#90) ([6982952](https://github.com/ngrx/platform/commit/6982952)), closes [#90](https://github.com/ngrx/platform/issues/90)
* **example-app:** Suppress StoreDevtoolsConfig compiler warning ([8804156](https://github.com/ngrx/platform/commit/8804156))
* **omit:** Strengthen the type checking of the omit utility function ([3982038](https://github.com/ngrx/platform/commit/3982038))
* **router-store:** NavigationCancel and NavigationError creates a cycle when used with routerReducer ([a085730](https://github.com/ngrx/platform/commit/a085730)), closes [#68](https://github.com/ngrx/platform/issues/68)
* **Store:** Exported initial state tokens (#65) ([4b27b6d](https://github.com/ngrx/platform/commit/4b27b6d))
* **Store:** pass all required arguments to projector (#74) ([9b82b3a](https://github.com/ngrx/platform/commit/9b82b3a))
* **Store:** Remove parameter destructuring for strict mode (#33) (#77) ([c9d6a45](https://github.com/ngrx/platform/commit/c9d6a45))
* **Store:** Removed readonly from type (#72) ([68274c9](https://github.com/ngrx/platform/commit/68274c9))
* **StoreDevtools:** Type InjectionToken for AOT compilation ([e21d688](https://github.com/ngrx/platform/commit/e21d688))


### Code Refactoring

* **Effects:** Simplified AP, added better error reporting and effects stream control ([015107f](https://github.com/ngrx/platform/commit/015107f))


### Features

* **build:** Updated build pipeline for modules ([68bd9df](https://github.com/ngrx/platform/commit/68bd9df))
* **Effects:** Ensure effects are only subscribed to once ([089abdc](https://github.com/ngrx/platform/commit/089abdc))
* **Effects:** Introduce new Effects testing module (#70) ([7dbb571](https://github.com/ngrx/platform/commit/7dbb571))
* **router-store:** Added action types (#47) ([1f67cb3](https://github.com/ngrx/platform/commit/1f67cb3)), closes [#44](https://github.com/ngrx/platform/issues/44)
* **store:** Add 'createSelector' and 'createFeatureSelector' utils (#10) ([41758b1](https://github.com/ngrx/platform/commit/41758b1))
* **Store:** Allow initial state function for AoT compatibility (#59) ([1a166ec](https://github.com/ngrx/platform/commit/1a166ec)), closes [#51](https://github.com/ngrx/platform/issues/51)
* **Store:** Allow parent modules to provide reducers with tokens (#36) ([069b12f](https://github.com/ngrx/platform/commit/069b12f)), closes [#34](https://github.com/ngrx/platform/issues/34)
* **Store:** Simplify API for adding meta-reducers (#87) ([d2295c7](https://github.com/ngrx/platform/commit/d2295c7))


### BREAKING CHANGES

* **Effects:** Effects API for registering effects has been updated to allow for multiple classes to be provided.

BEFORE:
```ts
@NgModule({
imports: [
EffectsModule.run(SourceA),
EffectsModule.run(SourceB)
]
})
export class AppModule { }
```

AFTER:
```ts
@NgModule({
imports: [
EffectsModule.forRoot([
SourceA,
SourceB,
SourceC,
])
]
})
export class AppModule { }

@NgModule({
imports: [
EffectsModule.forFeature([
FeatureSourceA,
FeatureSourceB,
FeatureSourceC,
])
]
})
export class SomeFeatureModule { }
```


# Changelogs

- [@ngrx/store](./modules/store/CHANGELOG.md)
- [@ngrx/effects](./modules/effects/CHANGELOG.md)
- [@ngrx/router-store](./modules/router-store/CHANGELOG.md)
- [@ngrx/store-devtools](./modules/store-devtools/CHANGELOG.md)
28 changes: 24 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,46 @@
npm install
```

OR
```
yarn
```

### Testing

```
npm test
```

OR

```
yarn test
```

## Submitting Pull Requests

**Please follow these basic steps to simplify pull request reviews - if you don't you'll probably just be asked to anyway.**

* Please rebase your branch against the current master
* Run ```npm install``` to make sure your development dependencies are up-to-date
* Run the `Setup` command to make sure your development dependencies are up-to-date
* Please ensure the test suite passes before submitting a PR
* If you've added new functionality, **please** include tests which validate its behavior
* Make reference to possible [issues](https://github.com/ngrx/platform/issues) on PR comment

## Submitting bug reports

* Please detail the affected browser(s) and operating system(s)
* Please be sure to state which version of node **and** npm you're using
* Search through issues to see if a previous issue has already been reported and/or fixed.
* Provide a _small_ reproduction using a [plunker template](http://plnkr.co/edit/tpl:757r6L?p=preview) or github repo.
* Please detail the affected browser(s) and operating system(s).
* Please be sure to state which version of Angular, node and npm you're using.

## Submitting New features

* We value keeping the API surface small and concise, which factors into whether new features are accepted.
* Submit an issue with the prefix `RFC: ` with your feature request.
* The feature will be discussed and considered.
* Once the PR is submitted, it will be reviewed and merged once approved.


## Financial contributions
Expand Down Expand Up @@ -63,4 +83,4 @@ Thank you to all our sponsors! (please ask your company to also support this ope
<a href="https://opencollective.com/ngrx/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/ngrx/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ngrx/sponsor/9/avatar.svg"></a>
135 changes: 130 additions & 5 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ The sections below cover the changes between the ngrx projects migrating from V1
[@ngrx/router-store](#ngrxrouter-store)
[@ngrx/store-devtools](#ngrxstore-devtools)

## Dependencies

You need to have the latest versions of TypeScript and RxJS to use ngrx V4 libraries.

TypeScript 2.4.x
RxJS 5.4.x

## @ngrx/core
@ngrx/core is no longer needed, and can conflict with @ngrx/store. You should remove it from your project.

Expand All @@ -36,7 +43,9 @@ import { compose } from '@ngrx/store';

### Action interface

The `payload` property has been removed from the `Action` interface.
The `payload` property has been removed from the `Action` interface. It was a source of type-safety
issues, especially when used with `@ngrx/effects`. If your interface/class has a payload, you need to provide
the type.

BEFORE:
```ts
Expand Down Expand Up @@ -72,6 +81,22 @@ export class MyEffects {
}
```

If you prefer to keep the `payload` interface property, you can provide your own parameterized version.

```ts
export interface ActionWithPayload<T> extends Action {
payload: T;
}
```

And if you need an unsafe version to help with transition.

```ts
export interface UnsafeAction extends Action {
payload?: any;
}
```

### Registering Reducers

Previously to be AOT compatible, it was required to pass a function to the `provideStore` method to compose the reducers into one root reducer. The `initialState` was also provided to the method as an object in the second argument.
Expand Down Expand Up @@ -215,7 +240,7 @@ import * as auth from '../actions/auth.actions';

@Injectable()
export class AppEffects {

@Effect()
init$: Observable<Action> = this.actions$
.ofType(Dispatcher.INIT)
Expand All @@ -224,7 +249,7 @@ export class AppEffects {
return of(new auth.LoginAction());

});

constructor(private actions$: Actions) { }
}
```
Expand All @@ -242,14 +267,14 @@ import * as auth from '../actions/auth.actions';

@Injectable()
export class AppEffects {

@Effect()
init$: Observable<Action> = defer(() => {

return of(new auth.LoginAction());

});

constructor(private actions$: Actions) { }
}

Expand Down Expand Up @@ -336,6 +361,8 @@ describe('My Effects', () => {

## @ngrx/router-store

### Registering the module

BEFORE:

`reducers/index.ts`
Expand Down Expand Up @@ -407,6 +434,104 @@ import { reducers } from './reducers';
export class AppModule {}
```

### Navigation actions

Navigation actions are not provided as part of the V4 package. You provide your own
custom navigation actions that use the `Router` within effects to navigate.

BEFORE:

```ts
import { go, back, forward } from '@ngrx/router-store';

store.dispatch(go(['/path', { routeParam: 1 }], { page: 1 }, { replaceUrl: false }));

store.dispatch(back());

store.dispatch(forward());
```

AFTER:

```ts
import { Action } from '@ngrx/store';
import { NavigationExtras } from '@angular/router';

export const GO = '[Router] Go';
export const BACK = '[Router] Back';
export const FORWARD = '[Router] Forward';

export class Go implements Action {
readonly type = GO;

constructor(public payload: {
path: any[];
query?: object;
extras?: NavigationExtras;
}) {}
}

export class Back implements Action {
readonly type = BACK;
}

export class Forward implements Action {
readonly type = FORWARD;
}

export type Actions
= Go
| Back
| Forward;
```

```ts
import * as RouterActions from './actions/router';

store.dispatch(new RouterActions.Go({
path: ['/path', { routeParam: 1 }],
query: { page: 1 },
extras: { replaceUrl: false }
});

store.dispatch(new RouterActions.Back());

store.dispatch(new RouterActions.Forward());
```
```ts
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
import { Effect, Actions } from '@ngrx/effects';
import * as RouterActions from './actions/router';

@Injectable()
export class RouterEffects {
@Effect({ dispatch: false })
navigate$ = this.actions$.ofType(RouterActions.GO)
.map((action: RouterActions.Go) => action.payload)
.do(({ path, query: queryParams, extras})
=> this.router.navigate(path, { queryParams, ...extras }));

@Effect({ dispatch: false })
navigateBack$ = this.actions$.ofType(RouterActions.BACK)
.do(() => this.location.back());

@Effect({ dispatch: false })
navigateForward$ = this.actions$.ofType(RouterActions.FORWARD)
.do(() => this.location.forward());

constructor(
private actions$: Actions,
private router: Router,
private location: Location
) {}
}
```
## @ngrx/store-devtools
**NOTE:** store-devtools currently causes severe performance problems when
Expand Down
Loading

0 comments on commit 90901e3

Please sign in to comment.