Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Normalizr #79

Closed
wants to merge 5 commits into from
Closed

[WIP] Normalizr #79

wants to merge 5 commits into from

Conversation

jaredpalmer
Copy link
Owner

@jaredpalmer jaredpalmer commented Jun 10, 2016

An attempt to implement normalizr. PostList and Post now share schema and a reducer, which is a weird result of this PR.

Still need to think this all the way through, but want to start a discussion.

Attempts to solve #76

@wedneyyuri
Copy link
Contributor

@jaredpalmer What do you think about a simple search page in your state? It could make the things more real.

@jaredpalmer
Copy link
Owner Author

@wedneyyuri trying to find a balance between example, boilerplate, and real-world app. I want things to keep things simple (and easy to delete), yet non-trivial. Ultimately, the point of this project is to show react SSR best-practices.

With that in mind, from a state management perspective, search results and the current PostList are identical, but a search input + results list would not leverage SSR and the power of the current config. Furthermore, you would still implement normalizr to get rid of the race condition created by storing a currentPost or currentSearchResult property in the state tree.

@jaredpalmer jaredpalmer temporarily deployed to spseo-pr-79 June 11, 2016 21:40 Inactive
@jaredpalmer jaredpalmer temporarily deployed to spseo-pr-79 June 11, 2016 22:45 Inactive
@jaredpalmer
Copy link
Owner Author

TODO:

  • Write tests
  • Decide on folder structure
  • Add docs to explain why Post and PostList share a reducer

@jaredpalmer jaredpalmer temporarily deployed to spseo-pr-79 June 11, 2016 22:54 Inactive
@jaredpalmer jaredpalmer temporarily deployed to spseo-pr-79 June 11, 2016 23:49 Inactive
@jaredpalmer
Copy link
Owner Author

Honestly, this PR changed my perspective on things.
hits joint

State is just a Database
Selectors are reusable queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants