-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Hi Folks,
I want to update the Normalizing State Shape docs.
I'm 100% on-board normalized state shape, and its benefits. However, while the docs allude to using the principles of database design whenever possible, it seems like the current docs go against this idea.
What I mean is that we have a relationship in the docs where a Post
has many Comments
. We model this relationship by having a Post
object contain a comments
key, which is an array of comment ids. If we were to follow database design principles, shouldn't the comment
have a postId
property indicating which post it belongs to? In other words, shouldn't the "foreign key" be on the comment, rather than on the post?
I'd like to propose two changes to the docs:
- Change the docs so that the "foreign key" is on the
Comment
, not on thePost
. - Change the docs so that we don't keep a list of
allIds
, since it seems to me that this is data that can be calculated, and therefore shouldn't be stored.
I haven't made a PR of these changes because I am not sure if I am missing something, but if a project maintainer thinks these changes would be improvements, I'd be happy to make a PR on it.