redux-orm icon indicating copy to clipboard operation
redux-orm copied to clipboard

Diagram visualizing how Redux-ORM works

Open haveyaseen opened this issue 7 years ago • 8 comments

Newcomers want to quickly understand how Redux-ORM does its job so that

  • they can more easily make the decision to start using the library and
  • so they know where in the codebase which issue may need to be solved.

I'm thinking of a diagram similar to this

image

taken directly from the Flux docs.

haveyaseen avatar Jun 01 '18 07:06 haveyaseen

Might pick this up since I'm using Redux ORM for the first time and introducing it to other devs I'm working with.

I've already created a diagram similar to the above that shows where Redux ORM integrates with Redux in the 'flow'.

I also noticed that the Redux ORM Primer https://github.com/tommikaikkonen/redux-orm-primer hasn't been updated in a while.

It seems that @markerikson has been leading the way with Redux ORM documentation through his Practical Redux series that goes through building Project Mini Mek: https://github.com/markerikson/project-minimek-educative

I felt that perhaps we could take the Redux ORM Primer, and update it with:

  1. A diagram like you suggested
  2. A project similar to Mark's but more focused on Redux ORM.

henrymoulton avatar Jul 04 '18 17:07 henrymoulton

Yeah, the Redux-ORM Primer could use an overhaul. Unfortunately Tommi isn't really invested in Redux-ORM anymore, so we will probably have to do something on our own.

That being said, I would be more than happy to include graphics in the wiki, and potentially in the README as well! Everything that helps users understand the library is welcome :slightly_smiling_face:

haveyaseen avatar Jul 05 '18 10:07 haveyaseen

Initial Diagram

Draft of the diagram I created that also explains Redux Thunk. Still lots of Redux ORM specific stuff to include but I thought beginners might want to have some clarity on Redux ORM NOT handling data fetching.

Open to ideas on what the Diagram should include.

henrymoulton avatar Jul 09 '18 18:07 henrymoulton

as a newcomer i would probably be still puzzled, but the same time - i have no any idea how simplify idea behind :( Great work!

Sent from iPhone

On Jul 9, 2018, at 13:57, henrymoulton [email protected] wrote:

Draft of the diagram I created, still lots of Redux ORM specific stuff to include but I thought beginners might want to have some clarity on Redux ORM NOT handling data fetching.

Open to ideas on what the Diagram should include.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

plandem avatar Jul 09 '18 19:07 plandem

I like the fact that you explained the one-way data flow so explicitly. What is missing from your diagram is that you just have Redux-ORM's reducer be called once and it automatically calls all registered models' reducers for you.

That is a good first step. Another diagram would be useful to see which steps are required to set up a session with all the necessary method calls and model subclasses.

haveyaseen avatar Jul 09 '18 19:07 haveyaseen

as a newcomer i would probably be still puzzled, but the same time - i have no any idea how simplify idea behind :( Great work!

That is a good first step. Another diagram would be useful to see which steps are required to set up a session with all the necessary method calls and model subclasses.

I think both of these comments are connected - the diagram is yet to show off setting up Redux ORM models which will probably be helpful.

Also, when writing about setting up Models and relations I imagine it would be good to highlight some resources for more 'pure' Front-End Developers to read about relations, RDMS, querying.

Once this is done I think guiding the user to the idea that actually having a normalised 'little' database in your Redux store could be a good idea.

henrymoulton avatar Jul 09 '18 22:07 henrymoulton

I've got some relevant links and sections on that topic in the Structuring Reducers section of the Redux docs.

markerikson avatar Jul 10 '18 10:07 markerikson

Some key concepts to convey for beginners would be:

  • Each model needs to be a class extends Model {}.
  • createReducer ensures that each Model's static reducer(action, model, session) is called upon dispatch.
  • createSelector ensures that passed functions will get re-executed ~if and only~ if a Model.reducer changes at least one relevant Model's table (or row, in the case of instance-based queries).

haveyaseen avatar Mar 20 '19 21:03 haveyaseen