MSD: wire up unseen notification dot icon logic in interim omnibar#109858
MSD: wire up unseen notification dot icon logic in interim omnibar#109858
Conversation
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
p-jackson
left a comment
There was a problem hiding this comment.
Nice, it was closer to working than I realised!
Our hacky wee Redux store is breaking more rules now. I believe the "rules of redux" are that the store reference shouldn't change between renders, and previously this was working because onToggleNotifications never changed and therefore the useMemo was never re-run. But now we're relying on the memo to be re-built whenever user changes 🤔 I think the technically correct way would be to update the data that gets returned by getState() and call the listeners.
But if it's not causing issues maybe this hack is still good enough for the interim solution. My main worry is that maybe it would leak memory or something? Would old components keep references to the old store through their listeners or something?
a3dc857 to
8d0456f
Compare
Good catch. After playing around the code a bit more, it turns out the Now things get interesting here. Subsequent updates are to be handled by listening to the But the thing is, I can't test this behavior. It should be correct but there's no way to verify it. It seems the whole web socket thing is broken. See: DOTMSD-1208 So this PR can only be tested by trying to get a new comment, then refresh the page and verify the dot appears. |
8eba53b to
a666548
Compare
|
I re-tested because I thought the PR looked like it would work (on refresh) in it's current state. The easiest way I found to get an unread notification is to leave a comment, and then have a testing user reply to that comment. I get the unread notifications icon on |
|
Thanks, interesting, it worked yesterday; but something might have messed up after today's refactor(s). Let me check... 😬 |
a666548 to
8a47f64
Compare
|
@p-jackson Please retest. Sorry the commit history is lost because I rewrote the changes against latest trunk instead of rebasing 😬 but I essentially added this: // Dispatch the user's unseen note count to the store so the unread marker appears.
useEffect( () => {
store.dispatch( {
type: 'NOTIFICATIONS_UNSEEN_COUNT_SET',
unseenCount: Number( !! user.has_unseen_notes ),
} );
}, [ store, user.has_unseen_notes ] );because after latest changes, |
Fixes DOTMSD-1202
Proposed Changes
This PR implements the unseen notification count logic in the fake interim omnibar's redux store.
Testing Instructions
dashboard/omnibarflag on, visit Site List.Pre-merge Checklist