-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
refactor: common discussion approach #3519
refactor: common discussion approach #3519
Conversation
#3165 |
e35a55e
to
8f66318
Compare
1 flaky test on run #5643 ↗︎
Details:
src/integration/research/write.spec.ts • 1 flaky test • ci-chrome
Review all test suite changes for PR #3519 ↗︎ |
fbd085e
to
c133b6f
Compare
@@ -201,7 +209,7 @@ export class DiscussionStore extends ModuleStore { | |||
} | |||
} | |||
|
|||
private async _addNotification( | |||
private async _addNotifications( |
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.
The plan is to move this to a cloud function anyway, so the mess in this function is temporary.
c133b6f
to
6257533
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.
Some overall comments:
- The
discussionsStore
doesn't really store anything related do discussions, it just calls firebase and the data is stored in theDiscussionWrapper
. Other than calling firebase, the only use of the store is to access theactiveUser
from theRootStore
.
If we call the userStore at theDiscussionWrapper
to access theactiveUser
, we could remove the dependency on RootStore and mobx and rename the class toDiscussionService
. QuestionDiscussion
andResearchComments
don't do much now, maybe can be removed in favor of usingDiscussionWrapper
directly?- Maybe the
#update-
logic could be simplified by just using the commentId and if the comment/discussion access the location hash directly.
const { discussionStore } = useCommonStores().stores | ||
const highlightedCommentId = window.location.hash.replace('#comment:', '') | ||
|
||
const transformComments = (discussion) => { |
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.
maybe there could be a const comments = useMemo(() => ,[discussion, activeUser])
that automatically transforms the comments when the discussion
or activeUser
changes.
So when there is a discussion update, you simply update the discussion state, the useMemo takes care of the rest and can pass the comments
to the discussionProps
.
6257533
to
32e12f3
Compare
c71e5f5
to
b257705
Compare
b257705
to
98350c2
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3519 +/- ##
==========================================
- Coverage 68.10% 68.01% -0.10%
==========================================
Files 441 443 +2
Lines 13973 13871 -102
Branches 2507 2493 -14
==========================================
- Hits 9516 9434 -82
+ Misses 4408 4389 -19
+ Partials 49 48 -1 ☔ View full report in Codecov by Sentry. |
@mariojsnunes From your comments:
|
98350c2
to
58a9a94
Compare
Visit the preview URL for this PR (updated for commit 41efdae): https://onearmy-next--pr3519-refactor-common-disc-32cd70a3.web.app (expires Fri, 21 Jun 2024 13:52:44 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59 |
🎉 This PR is included in version 1.182.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.185.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Until last week I hadn't really appreciated how differently the implementation for discussions on research is from the implementation for discussions on questions.
On questions, the store and component responsibilities are very seperate while for research, the responibilities are highly coupled.
This is a starting point to have a generalised approach to discussions which should make adding discussions to how-tos so much easier.
BREAKING CHANGE: No comment mentions for research. Will add a generalised approach later on. Discussed with Dave.
Now:
To-do:
DiscussionWrapper
,HideDiscussionContainer
,ResearchDisscussion
,QuestionDiscussion
Before releasing:
primaryContentId
to prod DBsWrite-up tickets:
DiscussionContainer
props