Interface Config<TState>

Optional (yet useful) configuration for state container

Type Parameters

  • TState extends Object

Hierarchy

  • Config

Properties

actionQueueMaxLength?: number

Default

1000

Configure the information to get displayed in console (for now it is the only place where this kind of the information is displayed).

keepState?: boolean

Makes container state immune to calling registerStateContainer function multiple times.

If set to true, other calls (but first) to registerStateContainer function won't override existing container state with initial state once again.

In fact, treat this rather as a debug flag, as it is rather unnecessary to call registerStateContainer function with keepState set to true. If so, it might be a sign something with container registration is not OK.

Setting does not affect unregisterStateContainer function - once "unregister" gets called, the state gets removed.

Default

false
managedAttributes?: {
    asyncOperationFlag?: keyof TState;
}

Experimental feature. Identify attributes that get managed completely by the state container! Set them here, but do not modify them in the reducer function!

Type declaration

  • Optional asyncOperationFlag?: keyof TState

    Indicate a boolean attribute in state that would act as an "asynchronous operation underway" flag.

    When an async action starts dispatching, field is set to true (and listeners that listen to path indicated by the field invoked).

    When (the very same) an async action finished dispatching, this field is set to false (listeners that listen to path indicated by the field invoked).

protectState?: boolean

If set to true, the state argument passed in the reducer function will be a cloned copy of the current state, not the state as it is in the container.

Please read the documentation for the registerStateContainer function, config arg.

Keep in mind mutating the state might be a good thing actually in some cases (especially from performance point of view), providing working/correct solution.

Please take into account the state object containing (callback) functions (more advanced scenarios) will not work with this flag, as objects containing functions cannot be cloned.

@default: true

Generated using TypeDoc