Angular NgRx自定义状态消毒剂

Angular NgRx自定义状态消毒剂,angular,redux,ngrx,Angular,Redux,Ngrx,谁能给我提供一个自定义状态消毒剂(StoreDevtoolsConfig.statesanizer)的示例,该消毒剂仅在redux tools扩展处于活动状态时生效。下面是我的定制消毒剂,它会一直生效 const stateSanitizer = (state: any) => { return { ...state, myView: { ...state.myView, myEditor: { ...state

谁能给我提供一个自定义状态消毒剂(StoreDevtoolsConfig.statesanizer)的示例,该消毒剂仅在redux tools扩展处于活动状态时生效。下面是我的定制消毒剂,它会一直生效

const stateSanitizer = (state: any) => {
   return {
    ...state,
    myView: {
        ...state.myView,
        myEditor: {
            ...state.myView.myEditor,
            myPhrases: 'LONG BLOB'
        }
    }
};
}

我要寻找的是如何在特定条件下应用我的自定义消毒剂,即redux工具处于活动状态。因此,以下条件适用于我的问题

declare global {
 interface Window {
   __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
 }
}

const stateSanitizer = (state: any) => {
  if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
     return {
         ...state,
         myView: {
           ...state.myView,
           myEditor: {
             ...state.myView.myEditor,
             myPhrases: 'LONG BLOB'
           }
         }
     };
  }
}