Replies: 1 comment
-
I shall preface by saying that I am also in the learning phase of using TCA. I have found that it helps if you think in term of data flow rather than just data representation. In your example, the normalized data model is required for storage into a relational database. However, you can not show that model on screen without denormalizing it! TCA just forces you to acknowledge the fact. With this out of the way, let me try and answer your questions:
You can not avoid the time complexity (i.e. denormalizing messages & members) is any solution. However, it appears that by creating a completely separate
You do end up with a lot of computed properties for child views! In my opinion, this is a good thing as the chil views can be previewed. In my case, I was able to show the child views in preview to other people before wiring them up into the app. This was very helpful in getting some feedback.
I would have used the denormalized I recommend you to look at https://github.com/Thomvis/Construct/ source code as it shows a complex CRUD app using TCA. The isowords game is also a fine example. However, it does not have many parallels to the domain you encounter in CRUD apps. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey TCA Community,
I've been struggling a bit trying to figure out how to organize my state with TCA. I've banged my head against this for quite some time now, and haven't been able to come up with a good solution. I'd appreciate any insight/thoughts that y'all have.
As an example, I'd like you to imagine that we're building a chat application. In this application, we have
Chats
,Messages
,Members
.A naive representation of the data, would look something like
My general heuristic for developing any kind of application is to first normalize everything. Applying this heuristic to my data, I would end up with something like
My naive attempt to map this structure to TCA results in the following
This mostly works just fine, but seems like a massive amount of effort to constantly be normalizing/de-normalizing the entire state tree each time any child changes.
For example, if I wanted to have a feature where a member could update their profile by navigating thru a chat, each keystroke would trigger the
set
for the ChatState.Or, if I add a
MessageComposerState
toChatState
that holds the pending message state, I would (1) have to also store a normalized version ofMessageComposerState
and (2) each update to theMessageComposerState
would trigger theset
for ChatState.Any help/feedback would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions