Move unread toggle into it's own hook. This functionality is used in native as well.
https://linear.app/comm/issue/ENG-861/refactor-unreadstatus-into-hook-for-both-native-and-web
Details
Toggle unread in web, make sure the functionality still works.
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
lib/hooks/toggle-unread-status.js | ||
---|---|---|
19 | We usually use onSomething name when something is an action, e.g. onClose or onFinish. onAfter doesn't sound right to me, but it might be just me. It is hard to find a good name that starts with on and expresses that it happens after toggle (onToggle might happen before, after, in the middle, etc. but we want to explicitly state that it is after). So maybe just afterAction? We don't need to start the name of every callback with on. And if we like to make this more reusable, afterAction should be an optional parameter, | |
45–49 | I know this code is only moved, but it might be good idea to be a little more explicit with the dependencies here (in a new diff), e.g. the callback doesn't depend on the whole threadInfo but instead on threadInfo.id and threadInfo.currentUser.unread. |