Skip to content
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

[HOLD for payment 2023-10-23] [$500] [Feature Request] Pressing back while writing notes makes text disappear #28599

Closed
1 of 6 tasks
kavimuru opened this issue Oct 2, 2023 · 39 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.

Comments

@kavimuru
Copy link

kavimuru commented Oct 2, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to a contacts DM
  2. Click on Private Note
  3. Click on My Note
  4. Type something (don't save)
  5. press the back button
  6. click on My Note again.
  7. Verify that the draft note you wrote has disappeared

Expected Result:

The note should not disappear

Actual Result:

The note disappears and we see a blank input page

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number:
Reproducible in staging?:
Reproducible in production?:
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
Notes/Photos/Videos: Any additional supporting documentation

Screencast.from.19-09-23.01_16_24.AM.IST.webm

Expensify/Expensify Issue URL:
Issue reported by: @Someshwar-Tripathi
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695047398155859

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012d86d9fa187b7292
  • Upwork Job ID: 1708808891588886528
  • Last Price Increase: 2023-10-02
  • Automatic offers:
    • DylanDylann | Contributor | 27097407
Issue OwnerCurrent Issue Owner: @johncschuster
@DylanDylann
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • [Inconsistency] Pressing back while writing notes makes text disappear

What is the root cause of that problem?

  • Currently, we do not have the logic "save as draft" for private notes like the message compose, so pressing back while writing notes makes the text disappear

What changes do you think we should make in order to solve the problem?

  • We can create the logic to save the private notes as draft for each reports as we do with the message composer:
  1. Create the collection PRIVATE_NOTES_DRAFT: 'privateNotesDraft_' to store the draft private note for each report.
  2. Create savePrivateNotesDraft(reportID, note) function to save the draft private note to local storage:
function privateNotesDraft(reportID, note) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT}${reportID}`, note);
}
  1. The onChangeText here
    <TextInput
    accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT}
    inputID="privateNotes"
    label={translate('privateNotes.composerLabel')}
    accessibilityLabel={translate('privateNotes.title')}
    autoCompleteType="off"
    autoCorrect={false}
    autoGrowHeight
    textAlignVertical="top"
    containerStyles={[styles.autoGrowHeightMultilineInput]}
    defaultValue={privateNote}
    value={privateNote}
    onChangeText={(text) => setPrivateNote(text)}
    ref={(el) => (privateNotesInput.current = el)}
    will become:
 onChangeText={(text) => {
                                    privateNotesDraft(reportID, text)
                                    setPrivateNote(text)
                                }}

Also, we can consider applying debounce to savePrivateNotesDraft

What alternative solutions did you explore? (Optional)

  • NA

@kavimuru kavimuru added the NewFeature Something to build that is a new item. label Oct 2, 2023
@melvin-bot melvin-bot bot added the Daily KSv2 label Oct 2, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Oct 2, 2023
@kavimuru kavimuru changed the title Pressing back while writing notes makes text disappear [Feature Request] Pressing back while writing notes makes text disappear Oct 2, 2023
@techievivek techievivek self-assigned this Oct 2, 2023
@techievivek
Copy link
Contributor

techievivek commented Oct 2, 2023

Taking over this as an engineer(CME) as I worked on implementing the private notes feature so I will able to add some value here.

@neonbhai
Copy link
Contributor

neonbhai commented Oct 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Pressing back while writing notes makes text disappear. We should save drafts as people could be writing important stuff and go back/close modal by mistake.

What is the root cause of that problem?

The TextInput element here is not configured to save drafts.

What changes do you think we should make in order to solve the problem?

We need to pass shouldSaveDraft here:

<TextInput
accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT}
inputID="privateNotes"
label={translate('privateNotes.composerLabel')}
accessibilityLabel={translate('privateNotes.title')}
autoCompleteType="off"
autoCorrect={false}
autoGrowHeight
textAlignVertical="top"
containerStyles={[styles.autoGrowHeightMultilineInput]}
defaultValue={privateNote}
value={privateNote}
onChangeText={(text) => setPrivateNote(text)}
ref={(el) => (privateNotesInput.current = el)}

What alternative solutions did you explore? (Optional)

xx

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 2, 2023
@techievivek techievivek added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Oct 2, 2023
@melvin-bot melvin-bot bot changed the title [Feature Request] Pressing back while writing notes makes text disappear [$500] [Feature Request] Pressing back while writing notes makes text disappear Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~012d86d9fa187b7292

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @robertKozik (External)

@techievivek
Copy link
Contributor

Quick question: What will be the behaviour if we edit multiple private notes? Would a single draft value handle all the edits or for each private notes we create unique draft to store it's value?

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 2, 2023

Taking over this as an engineer(CME) as I worked on implementing the private notes feature so I will able to add some value here

As I mentioned in my proposal, for each private notes we should create a unique draft to store it`s value like what we did with draft messages

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2023
@johncschuster
Copy link
Contributor

@techievivek what do you think about the above?

@melvin-bot melvin-bot bot removed the Overdue label Oct 5, 2023
@techievivek
Copy link
Contributor

@DylanDylann OK, great, that sounds like a plan. Thanks

@techievivek
Copy link
Contributor

@robertKozik can you please review the above proposals, thanks.

@jeet-dhandha
Copy link
Contributor

jeet-dhandha commented Oct 6, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • Feature Save Draft Private Note.

What is the root cause of that problem?

  • New Feature

What changes do you think we should make in order to solve the problem?

  • Create an action in Report.js.
function saveReportPrivateNoteDraft(reportID, note, accountID) {
    // Save the draft private note to Onyx
    // `reportPrivateNoteDraft_` 
    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_PRIVATE_NOTE_DRAFT}${reportID}`, note);
}
  • We will use similar implementaion as getDraftComment.ts to get the draft private note.

  • We will update onChangeText of PrivateNotesEditPage to save the draft private note.

<TextInput
    {...rest}
    onChangeText={(text) => {
        saveReportPrivateNoteDraft(reportID, text, session.accountID);
        setNoteText(text);
    }}
/>
  • Then we will update the savePrivateNote function to clear the draft private note.
  • Finally we will update the useState of PrivateNotesEditPage to get the draft private note.
const parser = new ExpensiMark();
+ const draftPrivateNot = useRef(getDraftPrivateNote(report.reportID, route.params.accountID));
const [privateNote, setPrivateNote] = useState(
-    parser.htmlToMarkdown(lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '')).trim()
+    draftPrivateNot.current || parser.htmlToMarkdown(lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '')).trim()
);

What alternative solutions did you explore? (Optional)

  • N/A

@robertKozik
Copy link
Contributor

Hi @techievivek! I've checked the existing proposals, and the one from @DylanDylann looks good and it was the first one which described whole process of implementing this new feature, so I think we can go for it. As for the debounce suggestion, I'm all for it - we don't need excessive onyx calls.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

Current assignee @techievivek is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@robertKozik
Copy link
Contributor

Thanks for heads up @MariaHCD I've briefy checked our PR and I think as well that our PR reintroduced this problem.

@DylanDylann It looks like this line is flawed https://github.com/Expensify/App/pull/29149/files#r1369162805

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Daily KSv2 labels Oct 23, 2023
@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Nov 20, 2023
Copy link

melvin-bot bot commented Nov 20, 2023

This issue has not been updated in over 15 days. @johncschuster, @techievivek, @robertKozik, @DylanDylann eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@robertKozik
Copy link
Contributor

Hey! I think the regression pointed before was fixed almost a month ago in this PR #30357.
Automation seems to didn't catch this

@DylanDylann
Copy link
Contributor

@johncschuster Could you help to process this issue?

@mountiny mountiny changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] [Feature Request] Pressing back while writing notes makes text disappear [HOLD for payment 2023-10-23] [$500] [Feature Request] Pressing back while writing notes makes text disappear Jan 24, 2024
@mountiny mountiny added Daily KSv2 and removed Reviewing Has a PR in review Monthly KSv2 labels Jan 24, 2024
@johncschuster
Copy link
Contributor

Sorry, I missed this! I'll process this later today!

@melvin-bot melvin-bot bot removed the Overdue label Jan 24, 2024
@johncschuster
Copy link
Contributor

Ok, I'm back.

@robertKozik I'm a bit confused – are you saying in this comment that the regression was already fixed?

@DylanDylann
Copy link
Contributor

@johncschuster The regression fixed long time ago

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@techievivek
Copy link
Contributor

Not overdue, @johncschuster can you please take a look at the above comment.

Copy link

melvin-bot bot commented Jan 30, 2024

@johncschuster, @techievivek, @robertKozik, @DylanDylann Huh... This is 4 days overdue. Who can take care of this?

@johncschuster
Copy link
Contributor

Sorry for my mix-up, everyone! @DylanDylann, I've issued payment through Upwork. I've also invited @Someshwar-Tripathi to this payment job and will take care of that payment once it's been accepted.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 31, 2024
@johncschuster
Copy link
Contributor

I've issued payment to @Someshwar-Tripathi. I think we can close this up! Please let me know if I've missed anything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.
Projects
None yet
Development

No branches or pull requests

9 participants