update: Thanks to some great suggestion I was able to fix my previous problem (or rather take another approach to create that functionality). The project is now fully functional.
Hi everybody!
I'm almost done with this challenge but in my final step I'm running into a problem and really hoping somebody can help me figuring it out.. much appreciated :)
The problem: In my project the notifications can be marked as 'read' either by clicking on a single notification or marking them all at once by the "mark all as read" button. These functions trigger a filter which returns the (new) number of unread messages and should update the state of the notifcations amount in the little blue box. But the latter is not happening at once, only when you click another post as read (so basically re-triggering this functionality) it updates. Simply put: the number of unread messages is always 1 behind for some reason. I'm definitely overlooking something here.. but I just can't seem to figure it out :(