From fa6cdf8e083c90016087365144ac31f218af9fef Mon Sep 17 00:00:00 2001 From: Keenan Johnson Date: Fri, 10 Apr 2020 01:02:45 -0400 Subject: [PATCH 1/2] docs(entity): Call setAll instead of deprecated addAll It is indicated in the documentation that addAll has been deprecated in favor of setAll. In the reducer switch/case example, addAll was still being used instead of setAll. --- docs/entity/adapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/entity/adapter.md b/docs/entity/adapter.md index 11e534a7ae..3439bdfcb9 100644 --- a/docs/entity/adapter.md +++ b/docs/entity/adapter.md @@ -252,7 +252,7 @@ export function reducer(state = initialState, action: UserActionsUnion): State { } case UserActionTypes.LOAD_USERS: { - return adapter.addAll(action.payload.users, state); + return adapter.setAll(action.payload.users, state); } case UserActionTypes.CLEAR_USERS: { From 6b1eadd8c78f975c4642041172fa50cd1cc248d6 Mon Sep 17 00:00:00 2001 From: Keenan Johnson Date: Fri, 10 Apr 2020 12:16:29 -0400 Subject: [PATCH 2/2] docs(entity): Revert change to old documentation, call setAll in new documentation This commit reverts the change to the old documentation and updates the new documentation with a call to setAll instead of addAll --- docs/entity/adapter.md | 2 +- projects/ngrx.io/content/guide/entity/adapter.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/entity/adapter.md b/docs/entity/adapter.md index 3439bdfcb9..11e534a7ae 100644 --- a/docs/entity/adapter.md +++ b/docs/entity/adapter.md @@ -252,7 +252,7 @@ export function reducer(state = initialState, action: UserActionsUnion): State { } case UserActionTypes.LOAD_USERS: { - return adapter.setAll(action.payload.users, state); + return adapter.addAll(action.payload.users, state); } case UserActionTypes.CLEAR_USERS: { diff --git a/projects/ngrx.io/content/guide/entity/adapter.md b/projects/ngrx.io/content/guide/entity/adapter.md index f564f49aff..5d84e8c258 100644 --- a/projects/ngrx.io/content/guide/entity/adapter.md +++ b/projects/ngrx.io/content/guide/entity/adapter.md @@ -181,7 +181,7 @@ const userReducer = createReducer( return adapter.removeMany(predicate, state); }), on(UserActions.loadUsers, (state, { users }) => { - return adapter.addAll(users, state); + return adapter.setAll(users, state); }), on(UserActions.clearUsers, state => { return adapter.removeAll({ ...state, selectedUserId: null });