商店更改时 NgRx 选择器不更新

jam*_*nde 0 ngrx ngrx-effects angular

我的应用程序中有不同的选择器,但由于某种原因,当我的商店发生更改时,这个特定的选择器不会更新,我不知道为什么。行的代码selectDataStream在第一次之后永远不会运行,随后的存储更改并且没有任何反应。我看到我的新值已在商店中更新。

成分:

   ngAfterViewInit(): void {
        if (this.fields && this.fields.length > 0) {
            this.store$.select<any[]>(getConnections(this.connectorId))
                .takeUntil(this.onDestroy$).subscribe(connections => {
                    this.selectDataStream.next(connections);
                    this.cdRef.detectChanges();
                });
        }
    }
Run Code Online (Sandbox Code Playgroud)

减速器代码:

const model = state.connectionresults[connectionId];

            const updatedstate = {
                ...state,
                connectionresults: {
                    ...state.connectionresults,
                    [connectionId]: {
                        ...model,
                        connections: [...payload]
                    }
                }               
            };

            return {
                ...updatedstate
            };
Run Code Online (Sandbox Code Playgroud)

选择器:

 export const selectConnectionResults = createSelector(
    selectFinderData,
    (state: FinderState) => state.connectionresults
);

     export const getConnections = (id) => createSelector(selectConnectionResults, entities => {
        return entities[id];
    });
Run Code Online (Sandbox Code Playgroud)

我做错了什么导致选择器无法触发?

jam*_*nde 5

发现问题了。我正在更新商店中的错误属性,并从不同的值中进行选择。:-)