[HOLD for payment 2021-10-30] Negative notification displayed in tab
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Unclear (?)
- Log in and open all unread messages in app.
Expected Result:
There should not be any negative number's in the notification status or badges
Actual Result:
There's a negative number of notifications for the user.
Workaround:
N/A
Platform:
Where is this issue occurring?
- Web
Version Number: 1.0.83-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
From @thienlnam https://expensify.slack.com/archives/C01GTK53T8Q/p1628105225147400
Seeing -1 with no unread messages
Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
I wonder if this is somehow related to https://github.com/Expensify/App/issues/4273.
Either way, looks like a good external issue!
Triggered auto assignment to @trjExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Could be related but a quick fix for this can be:
Proposal
In updateUnread/index.website.js
Change the code from const hasUnread = totalCount !== 0; --> const hasUnread = totalCount > 0;
This block in UnreadIndicatorUpdate must be causing it:
const throttledUpdatePageTitleAndUnreadCount = _.throttle(() => {
// If all of our nonzero unread action counts show -1, update the unread count to be -1 as well so we don't show a
// number in the indicator badge.
if (_.every(unreadActionCounts, count => count < 1) && _.some(unreadActionCounts, count => count === -1)) {
updateUnread(-1); // THIS CALL
return;
}
Looks like a dupe of this issue: https://github.com/Expensify/App/issues/4273 so I'm going to close this out. Let me know if you disagree, or missed something!
I think this issue should be reopened explained by my comments here: https://github.com/Expensify/App/issues/4273#issuecomment-927821515
-1 seems to be a special case we're intentionally setting as a count (see updateUnread(-1))
https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/index.js#L15-L18
But we're only handling the -1 case on iOS
https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.js#L9-L15
While the rest of the platforms leave the count as is:
Desktop
https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.js#L10-L14
Web
https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js#L11-L15
It's seems this comment is outdated:
If all of our nonzero unread action counts show -1, update the unread count to be -1 as well so we don't show a number in the indicator badge.
Because on iOS we're specifically showing (1) when totalCount is -1
Can we clarify the expected behavior when totalCount is -1
- show no badge/tab count
- show (1)
cc @trjExpensify
Thats the direction had put, starting we're forcefully updating -1 in my comment https://github.com/Expensify/App/issues/4425#issuecomment-893659947
Happy to reopen and investigate, let's get someone from the CME team to take a look. I'll re-add the label!
Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
@yuwenmemon I see you in the blame for the iOS files. Do you have any context you can add here?
Can we clarify the expected behavior when totalCount is -1
We should be showing (1)
Ok so it seems we can update the call updateUnread(-1) to have a check like in .ios and call with updateUnread(1). So that we don't make the -1 check per each platform
@trjExpensify Looks like this can go external now that we know what the expected behavior is
Triggered auto assignment to @iwiznia (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Perfect. Job is up on Upwork here, but I'm adding n6-hold 👍
Ok so it seems we can update the call updateUnread(-1) to have a check like in .ios and call with updateUnread(1). So that we don't make the -1 check per each platform
Sounds good to me. @trjExpensify can you hire @kidroca?
I've submitted a proposal in Upwork
Perfect, thanks! Hired! 👍
I've applied the change, but I can't find a way to test and verify it works
Tracing the code so far it seems a -1 count would be made when we have reports that have a preference of REPORT.NOTIFICATION_PREFERENCE.DAILY
This preference seems to be set from ReportDetailsPage
A link to this page seems to be available from the Report Header, but only for certain report types - isDefaultRoom
I don't seem to have any such reports (All my reports have chatType: '') and I don't know how to create one of the default types:
- CONST.REPORT.CHAT_TYPE.POLICY_ADMINS
- CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE
- or CONST.REPORT.CHAT_TYPE.DOMAIN_ALL
https://github.com/Expensify/App/blob/04083b154f5171b125fd92a8223e2863db799973/src/pages/home/HeaderView.js#L126-L133
When I press the header of a report I see participant(s) details
I can get to this page on web by appending /details to the url of a report, but can't do it on the rest of the platforms
any tips?
Ah @yuwenmemon, do you know how external contributors can access rooms to test, or is adding @kidroca to the beta the only way?