Skip to content

Reducer helpers for optimizing updates #14

Open
@andywhite37

Description

From a discussion with @mlms13

It might be handy to add some helper functions for filtering actions in the reducer that would result in a no-op/unnecessary Update.

One example is if your state is an AsyncData or AsyncResult, and it's currently in an Init state, and you dispatch an action that wants to map a function over your Complete(Ok(a)) value, but you're not in that state, it's better to return a NoUpdate rather than an Update that has no effect.

Example:

Update(AsyncResult.map(v => {...v, someChange}))

vs.

getOk >> fold(NoUpdate, v => Update(...))

There might be some handy helper functions for dealing with this to avoid unnecessary updates - it would be worth thinking about.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions