NGRX Store adapter.updateone 不更改更改检测的属性

Set*_*eth 1 ngrx angular

我有以下减速器:

case ProductionCommentActionTypes.EditCommentSuccess: {
  return adapter.updateOne(action.payload, state);
}
Run Code Online (Sandbox Code Playgroud)

其中有效负载是以下对象:

{ 
    id: number,
    changes: { 
       id: number;
       avatar: string;
       createdAt: Date;
       createdBy: string;
       body: string;
       discipline: string;
       isConcern: boolean;
       isResolved: boolean;
       plan_Id: number;
       resolution: {
                    id: number;
                    comment_Id: number;
                    avatar: string;
                    createdAt: Date;
                    createdBy: string;
                    body: string;   
                   }
      }
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我去更新对象时,我可以清楚地看到 action.payload 有我预期的数据。我已经检查了 action.payload 和效果:

  @Effect()
  resolveProductionConcernSuccess$: Observable<Action> = this.actions$
  .ofType<ResolveConcernSuccess>(ProductionCommentActionTypes.ResolveConcernSuccess).pipe(
    // Performing a get rather than an edit as the comment should have already 
    // been updated in the service when the resolution was added.
    switchMap(action => this.commentService.getComment(action.payload.comment_Id)), 
          map((comment: any) => {
            comment.updatedBy = "test";
        return new EditCommentSuccess(comment);
      }),
    catchError(err => of(new EditCommentFail(err)))
  );
Run Code Online (Sandbox Code Playgroud)

但是,我从中看到的:

  this.comments$ = rootStore.select<Comment[]>(fromRoot.getCommentsForSelectedPlan);
this.comments$.subscribe(res => console.log(res));
Run Code Online (Sandbox Code Playgroud)

是旧数据,即使触发了更改。我至少希望看到updatedBy =“test”。如果我单步调试调试器,我还会在 updateOne之后立即看到有关状态的旧数据。

另一种说法是

      return adapter.updateOne(action.payload, state);
Run Code Online (Sandbox Code Playgroud)

尽管有效载荷中有正确的值,但似乎实际上并没有改变任何东西。

为什么状态上的属性实际上没有更新?有没有合适的方法来做到这一点?

Set*_*eth 5

问题出在减速器上。

return adapter.updateOne({ id: action.payload.id, changes: action.payload }, state);