Skip to content

[1.0] Use Redux for managing Gatsby's internal server state #777

Closed
@KyleAMathews

Description

I've been prototyping using Redux for managing Gatsby's internal server/cli state to replace the somewhat ad-hoc data management code.

I needed to refactor this code anyways to get data hot reloading working (#1 requested feature for people experimenting with Gatsby v1) and figured I'd try this out.

I'm about 1/2 way through ripping out the old code and replacing it with Redux but I've very positive about the direction. The data flows are much simpler, much more testable, and it's suggesting very positive changes to a few Gatsby APIs.

And the nice thing about Redux is since the community is huge, like with GraphQL, we'll get freebies by adopting Redux.

E.g. built-in devtools support.

This screenshot is the Redux devtools looking at an action from my Gatsby blog where I opened a markdown file, made a small change, and saved it and this is the resulting state diff.

screen shot 2017-04-03 at 11 56 48 pm

In addition to the nice code improvements plus our now built-in supercharged debugger, using Redux will make Gatsby's code base feel very approachable to many of its users who will have experience using Redux on client-side apps.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions