NgRx 中的 reducer enhancer 相当于什么?

What is the equivalent of a reducer enhancer in NgRx?

我正在尝试使用@ngrx/store在我的应用程序中实现undo/redo功能。

此处描述了基本概念(Redux):https://redux.js.org/recipes/implementing-undo-history

在配方中的某些时候,reducer 函数被包装在 Redux 中称为 reducer enhancer

的东西中

A reducer enhancer (or a higher order reducer) is a function that takes a reducer, and returns a new reducer that is able to handle new actions, or to hold more state, delegating control to the inner reducer for the actions it doesn't understand.

这在 NgRx 中相当于什么?如何构建商店...

store.pipe(select('counter')); 

... 但将其包装在 'enhancer' 函数中?伪代码:

undoable(store.pipe(select('counter'));

有人向我指出了 meta-reducers (https://ngrx.io/guide/store/metareducers),但相关文档并未为我解决问题。

Meta-reducers 是这里的正确答案。它与 redux 文档具有相同的 API,它接收一个 reducer 和 returns 一个 reducer。另一个示例可能是在用户注销时刷新状态的用例。