You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, I want to have single place in app, where all data uniquely tied to particular message are held, I also want to have only one (clear) way how to save/update/retrieve message data in/from realm.
Description
Type: Problem
Summary: Currently, we have message data all over the place in app-db and realm. It's directly attached as an ordered sequence under [:chats chat-id :messages] key, then we have some data related to messages indexed by message id in [:message-data :preview], [:message-data :short-preview], [:message-data :status] and soon also in [:handler-data] and [:message-id->pending-messages].
It's even worse for the realm persistence API, where something is held in message objects, something not (handler-data, pending-messages).
Every-time when we need to have something message-related with random access by message-id, we invent a new place in app-db where we put it, then we have to keep track of it in subscriptions, when updating messages, write boilerplate code for realm persistence, etc.
Solution
Summary: We well move everything message related under [:message-by-id] (or [:id->message]) path in app-db. We will rework our realm schema, and persistence functions, eliminate boilerplate and use only handful of message related functions to do everything in regard of message persistence.
Under [:chats chat-id :messages] we will have (ordered) vector of message-references, such as:
As mentioned, ordering of the messages will be maintained by ordering of message references (responsibility of db functions updating [:chats chat-id :messages] data) and it will be job of messages subscription(s) to use the references to look-up actual message objects and return it as sequence to view layer.
The text was updated successfully, but these errors were encountered:
User Story
As a developer, I want to have single place in app, where all data uniquely tied to particular message are held, I also want to have only one (clear) way how to save/update/retrieve message data in/from realm.
Description
Type: Problem
Summary: Currently, we have message data all over the place in app-db and realm. It's directly attached as an ordered sequence under
[:chats chat-id :messages]
key, then we have some data related to messages indexed by message id in[:message-data :preview]
,[:message-data :short-preview]
,[:message-data :status]
and soon also in[:handler-data]
and[:message-id->pending-messages]
.It's even worse for the realm persistence API, where something is held in message objects, something not (handler-data, pending-messages).
Every-time when we need to have something message-related with random access by message-id, we invent a new place in app-db where we put it, then we have to keep track of it in subscriptions, when updating messages, write boilerplate code for realm persistence, etc.
Solution
Summary: We well move everything message related under
[:message-by-id]
(or[:id->message]
) path in app-db. We will rework our realm schema, and persistence functions, eliminate boilerplate and use only handful of message related functions to do everything in regard of message persistence.Under
[:chats chat-id :messages]
we will have (ordered) vector of message-references, such as:As mentioned, ordering of the messages will be maintained by ordering of message references (responsibility of db functions updating
[:chats chat-id :messages]
data) and it will be job of messages subscription(s) to use the references to look-up actual message objects and return it as sequence to view layer.The text was updated successfully, but these errors were encountered: