Search code examples
angularreduxngrx

What's the use of the logOnly option in ngrx DevTools?


I've read the minimalistic docs at https://github.com/ngrx/platform/tree/master/docs/store-devtools, and understood that you can add instrumentation as follows:

StoreDevtoolsModule.instrument({
  logOnly: environment.production
})

Supposedly, if the logOnly flag is true, your app will connect to the Redux DevTools extension in a log only mode, it'll have very little overhead as it shouldn't store the state data, but only log the action names that are happening during the runtime.

But in my experiments, I still see the state data in the ngrx DevTools panel, so what're the benefits of using logOnly:true?


Solution

  • According to the documentation:

    logOnly: boolean - connect to the Devtools Extension in log-only mode. Default is false which enables all extension features.

    With a link to the extensions features.

    Based on this we can assume that setting logOnly to true will switch the following redux-devtools-extension features off:

    const composeEnhancers = composeWithDevTools({
        features: {
            pause: true, // start/pause recording of dispatched actions
            lock: true, // lock/unlock dispatching actions and side effects    
            persist: true, // persist states on page reloading
            export: true, // export history of actions in a file
            import: 'custom', // import history of actions from a file
            jump: true, // jump back and forth (time travelling)
            skip: true, // skip (cancel) actions
            reorder: true, // drag and drop actions in the history list 
            dispatch: true, // dispatch custom actions or action creators
            test: true // generate tests for the selected actions
        }
    })
    

    This is ideal for production environments as you may not need or want these primarily dev-focused features running in your live application.