Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ngrx/platform
Browse files Browse the repository at this point in the history
* 'master' of github.com:ngrx/platform: (35 commits)
  chore(Example): Add login info to example app. Fix sidenav issue with IE (ngrx#436)
  chore(docs): Fix OnRunEffects example (ngrx#430)
  chore(docs): Add docs on usage of custom router state serializer with store freeze (ngrx#426)
  chore(docs): Add missing from in metareducer example. (ngrx#418)
  docs(Entity): Fix examples for @ngrx/entity usage (ngrx#415)
  feat(Entity): Add default selectId function for EntityAdapter (ngrx#405)
  fix(Example): Add missing import for catch operator (ngrx#409)
  docs(effects): Remove usage of deprecated `toPayload` util in example (ngrx#407)
  chore(Example): Add Jest as test runner for example tests (ngrx#371)
  fix(Store): Refactor parameter initialization in combineReducers for Closure
  feat(Entity): Rename 'sort' to 'sortComparer'
  chore(docs): Minor fixes to entity interfaces documentation (ngrx#390)
  chore(docs): Change providing injected reducers by factory instead of value (ngrx#387)
  fix(Store): Fix typing for feature to accept InjectionToken (ngrx#375)
  chore(docs): Update @ngrx/entity documentation examples and usage (ngrx#369)
  docs(entity): Fix typo in url (ngrx#365)
  chore(Example): Documented @ngrx/entity and added to example app (ngrx#328)
  fix(RouterStore): Stringify error from navigation error event (ngrx#357)
  chore(docs): Fix action interface example (ngrx#360)
  chore(Example): Added ngrx-store-freeze meta-reducer to example application (ngrx#343)
  ...
  • Loading branch information
sharikovvladislav committed Sep 28, 2017
2 parents a404001 + e63720e commit 5b81826
Show file tree
Hide file tree
Showing 66 changed files with 3,405 additions and 491 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[ ] 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?
Expand Down
11 changes: 0 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@

### Setup

```
npm install
```

OR
```
yarn
```

### Testing

```
npm test
```

OR

```
yarn test
```
Expand Down
20 changes: 19 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,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 @@ -79,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
2 changes: 1 addition & 1 deletion build/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ export function getBottomLevelName(packageName: string) {
}

export function baseDir(...dirs: string[]): string {
return path.resolve(__dirname, '../', ...dirs);
return `"${path.resolve(__dirname, '../', ...dirs)}"`;
}
9 changes: 4 additions & 5 deletions docs/effects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,20 @@ want to use to perform a side effect.
// ./effects/auth.ts
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/catch';
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { Action } from '@ngrx/store';
import { Actions, Effect, toPayload } from '@ngrx/effects';
import { Actions, Effect } from '@ngrx/effects';
import { of } from 'rxjs/observable/of';

@Injectable()
export class AuthEffects {
// Listen for the 'LOGIN' action
@Effect() login$: Observable<Action> = this.actions$.ofType('LOGIN')
// Map the payload into JSON to use as the request body
.map(toPayload)
.mergeMap(payload =>
this.http.post('/auth', payload)
.mergeMap(action =>
this.http.post('/auth', action.payload)
// If successful, dispatch success action with result
.map(data => ({ type: 'LOGIN_SUCCESS', payload: data }))
// If request fails, dispatch failed action
Expand Down
6 changes: 3 additions & 3 deletions docs/effects/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ import 'rxjs/add/operator/takeUntil';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Action } from '@ngrx/store';
import { Actions, Effect, OnRunEffects, EffectsNotification } from '@ngrx/effects';
import { Actions, Effect, OnRunEffects, EffectNotification } from '@ngrx/effects';

@Injectable()
export class UserEffects implements OnRunEffects {
Expand All @@ -119,9 +119,9 @@ export class UserEffects implements OnRunEffects {
console.log(action);
});

ngrxOnRunEffects(resolvedEffects$: Observable<EffectsNotification>) {
ngrxOnRunEffects(resolvedEffects$: Observable<EffectNotification>) {
return this.actions$.ofType('LOGGED_IN')
.exhaustMap(() => resolvedEffects$.takeUntil('LOGGED_OUT'));
.exhaustMap(() => resolvedEffects$.takeUntil(this.actions$.ofType('LOGGED_OUT')));
}
}
```
Expand Down
24 changes: 24 additions & 0 deletions docs/entity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @ngrx/entity

Entity State adapter for managing record collections.

@ngrx/entity provides an API to manipulate and query entity collections.

- Reduces boilerplate for creating reducers that manage a collection of models.
- Provides performant CRUD operations for managing entity collections.
- Extensible type-safe adapters for selecting entity information.

### Installation
Install @ngrx/entity from npm:

`npm install @ngrx/entity --save` OR `yarn add @ngrx/entity`


### Nightly builds

`npm install github:ngrx/entity-builds` OR `yarn add github:ngrx/entity-builds`

## API Documentation
- [Interfaces](./interfaces.md)
- [Entity Adapter](./adapter.md)
- [Selectors](./adapter.md#entity-selectors)
Loading

0 comments on commit 5b81826

Please sign in to comment.