-
Notifications
You must be signed in to change notification settings - Fork 983
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
Effects should be dumb, without any logic #3228
Conversation
e7cfa65
to
8bbdbf3
Compare
@@ -173,4 +172,4 @@ | |||
:clear-history | |||
(fn [{{:keys [current-chat-id] :as db} :db} _] | |||
{:db (assoc-in db [:chats current-chat-id :messages] {}) | |||
::chat-events/delete-messages current-chat-id})) | |||
:delete-messages current-chat-id})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you changed this to an unqualified keyword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because implicitly qualified keywords are exceptionally bad idea when they are used outside the namespace where they were defined (and that was the case).
So it was ::delete-messages
keyword defined in status-im.chat.handlers
ns, and grep
for for ::delete-messages
revealed that the keyword is used only there - so far so good, but then I realised, then some other namespace status-im.ui.screens.group.chat-settings.events
is actually importing the former namespace and refering to that keyword as ::chat-events/delete-messages
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! We should add this to guidelines somewhere, just to be aware if we see the same conundrum again
I would move these events in the data-store with data-store.message namespace though |
@yenda Correct, that's what I ultimately want to do once all |
32c7a43
to
34271f9
Compare
34271f9
to
0e5c2ce
Compare
Branch: PR-3228 |
0e5c2ce
to
86aea8a
Compare
Works towards status-im/swarms#74 idea
Summary:
Coeffects/effects should be simple and not contain any logic other then implementation details about how the side effects are actually translated (whether it's direct call, queueing for later processing, batching, etc.) so they can be re-used to maximal extent.
Having actual application logic is them is bad because:
Also, I removed
:message-overhead
field in chat realm/app-db entity and every logic associated with it. It looks like some relict from older code, we were setting it, but it was never actually red.As another thing, it fixes #3249
Testing notes (optional):
Chat regression testing
status: ready