-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: converted notification redux structure to context API #598
Conversation
4c2b880
to
8967d0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a context folder and move all the context there.
995a8a7
to
f7f52f3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #598 +/- ##
==========================================
+ Coverage 72.47% 78.00% +5.53%
==========================================
Files 52 74 +22
Lines 821 1205 +384
Branches 169 253 +84
==========================================
+ Hits 595 940 +345
- Misses 216 254 +38
- Partials 10 11 +1 ☔ View full report in Codecov by Sentry. |
37206bd
to
d77a779
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'd suggest is that I noticed the test files for NotificationRowItem
, NotificationSections
, and NotificationTabs
start with a lowercase letter, but that's probably more of a nit pick than something that would affect the tests passing/failing.
Otherwise, this looks okay to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, with a few clarifying higher level questions (e.g., around the boundaries between notifications and the authenticated user dropdown). Most of the comments pertain to styling/theming, addressing ESLint rules like react-hooks/exhaustive-deps
vs. disabling them, and a sanity check around a possible race condition when marking notification as "read" when clicking a hyperlink.
84c2b01
to
12d8092
Compare
2e950e6
to
f7f51e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a couple comments. I appreciate all your iteration through the feedback! 🙌
https://2u-internal.atlassian.net/browse/INF-1603
Purpose
The purpose of converting the notification architecture from Redux to the Context API is to eliminate duplicated providers and stores, streamlining the structure and improving efficiency in managing state across the application.
Description
We have refactored the state management of the notification tray, transitioning from Redux to the Context API as the central store. This involved replacing all dispatch calls in the reducer with direct API calls, and managing server data through the Context provider. This change centralizes state management and resolves the issue of duplicate providers.
We have introduced a new waffle flag, “notifications.enable_new_notification_view,” in the backend as part of PR #35569.
All changes related to the Context API have been organized in a new folder named “new-notifications,” while the existing Redux architecture remains intact in the “Notifications” folder. This approach allows us to test the Context API structure by enabling the waffle flag on the staging environment. Once testing is complete, we plan to remove the Redux-related notifications folder and exclusively utilize the new notifications folder that incorporates the Context API changes.
Test
I conducted testing on the local machine by enabling these waffle flags and following the instructions outlined in the document found here:
Note: I have made updates specifically for the Learning Header for now. Since the Discussion MFE uses the Learning Header, I tested the notification tray locally on that implementation.