Problem
We currently have used a double onyx call on the profile page to subscribe to the DM chat report in order for notification preference to update correctly for the profile page. This was reported during PR review here: #28200 (comment)
|
// eslint-disable-next-line rulesdir/no-multiple-onyx-in-file |
|
withOnyx({ |
|
report: { |
|
key: ({route, session}) => { |
|
const accountID = Number(lodashGet(route.params, 'accountID', 0)); |
|
if (Number(session.accountID) === accountID || Session.isAnonymousUser()) { |
|
return null; |
|
} |
|
return `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(ReportUtils.getChatByParticipants([accountID]), 'reportID', '')}`; |
|
}, |
|
}, |
|
}), |
Discussed here: #28200 (comment)
Why is this important?
Using a double Onyx subscription for any component is not a recommended practice so it would be nice to clean that up. Moreover, we have now enabled the notification preference option for all the chat reports so maybe we can create a separate component for the notification preference page and reuse that across various pages.
Solution
Create a separate component for notification preference and get rid of the double onyx call on the profile page. Feel free to come up with your own solutions.
Here is a potential solution to the problem: #28200 (comment)
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~013768a6222352d168
- Upwork Job ID: 1711676109112000512
- Last Price Increase: 2023-10-24
- Automatic offers:
- pradeepmdk | Contributor | 27435339
Problem
We currently have used a double onyx call on the profile page to subscribe to the DM chat report in order for notification preference to update correctly for the profile page. This was reported during PR review here: #28200 (comment)
App/src/pages/ProfilePage.js
Lines 306 to 317 in a63f853
Discussed here: #28200 (comment)
Why is this important?
Using a double Onyx subscription for any component is not a recommended practice so it would be nice to clean that up. Moreover, we have now enabled the notification preference option for all the chat reports so maybe we can create a separate component for the notification preference page and reuse that across various pages.
Solution
Create a separate component for notification preference and get rid of the double onyx call on the profile page. Feel free to come up with your own solutions.
Here is a potential solution to the problem: #28200 (comment)
Upwork Automation - Do Not Edit