You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Awaiting C+ for payment][$500] Profile - Private notes doesn't appear on profile when navigate via Share code link #35654
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Version Number: 1.4.35-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: applause-Internal Team Slack conversation:
Action Performed:
Precondition:
User A have a existing conversation with User B
While logged out User A navigate to conversation with User B via Share code link
Take a note of the Profile modal
Expected Result:
Since there is a existing conversation between users - on the Profile modal Private notes should be present
Actual Result:
Private notes does not appear on existing conversation when navigate logged out via Share code link
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Profile - Private notes doesn't appear on profile when navigate via Share code link[/-][+][$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/+]on Feb 2, 2024
As getChatByParticipants depends on the reports from onyx if it is not yet fetched from BE when the profile page is rendered it will result in null reportID and privates notes not displayed
What changes do you think we should make in order to solve the problem?
In cases where the report is empty we need to subscribe to the reports collection (onyxSubscribe) and when it is successfully populated in onyx we need to recalculate via getChatByParticipants to get report when the reports list is successfully fetched from BE in Profile Page.
What alternative solutions did you explore? (Optional)
We can also think of having the reportID data in the route in that case we don't depend on the getChatByParticipants to get the reportID
Please re-state the problem that we are trying to solve in this issue.
Profile - Private notes doesn't appear on profile when navigate via Share code link
What is the root cause of that problem?
In case of report data, previousKey and newKey in here are always the same, that leads to the logic here never runs. So the report data in ProfilePage is always empty. Below is detail:
The report key is a function, with the input is {route, session} and return the reportID. But this function also needs a reports.
We get the previousKey and newKey based on the prop and state of the component, but in this case, the reports does not come from prop and state, instead it is a global variable, so Str.result(mapping.key, {...prevProps, ...prevOnyxDataFromState}) and Str.result(mapping.key, {...this.props, ...onyxDataFromState}) are always the same.
What changes do you think we should make in order to solve the problem?
Based on the above RCA, we can fix the issue by updating the report key to use the reports from component `s props and state rather than global variable.
changed the title [-][HOLD for payment 2024-03-07] [$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/-][+][Awaiting C+ for payment][$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/+]on Mar 11, 2024
@trjExpensify I have discussed this internally. You may close this issue as I am keeping track of payment internally and will ask to pay once the issue is resolved. Just write in the payment summary that I have not been paid yet.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Activity
melvin-bot commentedon Feb 2, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0145bd5b64b244e0b6
[-]Profile - Private notes doesn't appear on profile when navigate via Share code link[/-][+][$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/+]melvin-bot commentedon Feb 2, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)melvin-bot commentedon Feb 2, 2024
Triggered auto assignment to @miljakljajic (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.izarutskaya commentedon Feb 2, 2024
We think that this bug might be related to #vip-vsb
CC @quinthar
FitseTLT commentedon Feb 2, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Private notes doesn't appear on profile when navigate via Share code link
What is the root cause of that problem?
The problem lies in how we are getting the reportID for the 1to1 chat report here as it depends on the reports list in onyx
App/src/pages/ProfilePage.js
Lines 281 to 287 in 9d4c634
As
getChatByParticipantsdepends on the reports from onyx if it is not yet fetched from BE when the profile page is rendered it will result in null reportID and privates notes not displayedApp/src/pages/ProfilePage.js
Lines 238 to 239 in 9d4c634
Similarly notification preference is not shown too
App/src/pages/ProfilePage.js
Lines 135 to 136 in e791ecc
What changes do you think we should make in order to solve the problem?
In cases where the report is empty we need to subscribe to the reports collection (
onyxSubscribe) and when it is successfully populated in onyx we need to recalculate viagetChatByParticipantsto get report when the reports list is successfully fetched from BE inProfile Page.What alternative solutions did you explore? (Optional)
We can also think of having the reportID data in the route in that case we don't depend on the
getChatByParticipantsto get the reportIDdukenv0307 commentedon Feb 5, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
previousKeyandnewKeyin here are always the same, that leads to the logic here never runs. So thereportdata in ProfilePage is always empty. Below is detail:reportkey is a function, with the input is{route, session}and return thereportID. But this function also needs areports.previousKeyandnewKeybased on the prop and state of the component, but in this case, thereportsdoes not come from prop and state, instead it is a global variable, soStr.result(mapping.key, {...prevProps, ...prevOnyxDataFromState})andStr.result(mapping.key, {...this.props, ...onyxDataFromState})are always the same.What changes do you think we should make in order to solve the problem?
reportsfrom component `s props and state rather than global variable.so we can pass the
reportsdata to it.App/src/pages/ProfilePage.js
Lines 284 to 304 in 0ae07be
export default compose( withLocalize, withOnyx( { reports: { key: ONYXKEYS.COLLECTION.REPORT, }, personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST, }, session: { key: ONYXKEYS.SESSION, }, report: { + key: ({route, session, reports}) => { const accountID = Number(lodashGet(route.params, 'accountID', 0)); + const reportID = lodashGet(ReportUtils.getChatByParticipants([accountID], reports), 'reportID', ''); if ((session && Number(session.accountID) === accountID) || Session.isAnonymousUser() || !reportID) { return null; } return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, }, }, ), )(ProfilePage);What alternative solutions did you explore? (Optional)
https://github.com/Expensify/react-native-onyx/blob/13936aee27bb0cb8c98cb6bf3941044f3d5958ce/lib/withOnyx.js#L133-L137
to:
+ if (previousKey !== newKey || !this.activeConnectionIDs[previousKey]) { Onyx_1.default.disconnect(this.activeConnectionIDs[previousKey], previousKey); delete this.activeConnectionIDs[previousKey]; this.connectMappingToOnyx(mapping, propName, newKey); }melvin-bot commentedon Feb 5, 2024
@miljakljajic, @shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!
76 remaining items
shubham1206agra commentedon Mar 11, 2024
@trjExpensify Can you hold my payment temporarily as per https://expensify.slack.com/archives/C02NK2DQWUX/p1710150138788529?
trjExpensify commentedon Mar 11, 2024
Yep, please comment here when your ready. Dropping to
Weeklyand updating the title.[-][HOLD for payment 2024-03-07] [$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/-][+][Awaiting C+ for payment][$500] Profile - Private notes doesn't appear on profile when navigate via Share code link[/+]shubham1206agra commentedon Mar 27, 2024
@trjExpensify I have discussed this internally. You may close this issue as I am keeping track of payment internally and will ask to pay once the issue is resolved. Just write in the payment summary that I have not been paid yet.
trjExpensify commentedon Apr 2, 2024
Sounds good, closing!
shubham1206agra commentedon Apr 17, 2024
@trjExpensify We can process payment here now.
trjExpensify commentedon Apr 18, 2024
Sent a new offer.
shubham1206agra commentedon Apr 18, 2024
Accepted
trjExpensify commentedon Apr 18, 2024
Paid!