notifications: clear before applying unreads

Fixes urbit/landscape#646
This commit is contained in:
Liam Fitzgerald 2021-03-26 08:11:53 +10:00
parent 4af01cdf53
commit 1f0b6d5a9c
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -204,6 +204,7 @@ function unreadEach(json: any, state: HarkState): HarkState {
function unreads(json: any, state: HarkState): HarkState { function unreads(json: any, state: HarkState): HarkState {
const data = _.get(json, 'unreads'); const data = _.get(json, 'unreads');
if(data) { if(data) {
state = clearState(state);
data.forEach(({ index, stats }) => { data.forEach(({ index, stats }) => {
const { unreads, notifications, last } = stats; const { unreads, notifications, last } = stats;
updateNotificationStats(state, index, 'last', () => last); updateNotificationStats(state, index, 'last', () => last);