-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix/28599: Pressing back while writting notes make text disappear #29149
Fix/28599: Pressing back while writting notes make text disappear #29149
Conversation
@robertKozik Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
src/libs/actions/Report.js
Outdated
const draftNoteMap = {}; | ||
Onyx.connect({ | ||
key: ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT, | ||
callback: (value, key) => { | ||
if (!key) { | ||
return; | ||
} | ||
|
||
const reportID = key.replace(ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT, ''); | ||
draftNoteMap[reportID] = value; | ||
}, | ||
}); |
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.
As I see most of the similar statements are on the top of the file, can we move it there?
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.
Yeah, we can do it. just updated it, please help check
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromeios.-.android.-.web.movMobile Web - Safariios.-.android.-.web.movDesktopdesktop.moviOSios.-.android.-.native.movAndroidios.-.android.-.native.mov |
src/libs/actions/Report.js
Outdated
@@ -2183,6 +2196,21 @@ function clearPrivateNotesError(reportID, accountID) { | |||
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {privateNotes: {[accountID]: {errors: null}}}); | |||
} | |||
|
|||
export default function getDraftPrivateNote(reportID) { |
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.
I missed that one before, why this function is export default
? Can we get rid of it? Other functions don't need it @DylanDylann
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.
Updated. Please help check
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.
Great thanks!
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 🚀
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.
Great work. 🚀
@@ -87,6 +87,19 @@ Onyx.connect({ | |||
}, | |||
}); | |||
|
|||
const draftNoteMap = {}; |
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.
NAB: Maybe privateNotesDraftMap
? So we exactly know it is something related to private notes feature.
🚀 Deployed to staging by https://github.com/techievivek in version: 1.3.81-4 🚀
|
🚀 Deployed to staging by https://github.com/techievivek in version: 1.3.83-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
2 similar comments
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
@@ -63,7 +63,23 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) { | |||
|
|||
// We need to edit the note in markdown format, but display it in HTML format | |||
const parser = new ExpensiMark(); | |||
const [privateNote, setPrivateNote] = useState(parser.htmlToMarkdown(lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '')).trim()); | |||
const [privateNote, setPrivateNote] = useState( | |||
Report.getDraftPrivateNote(report.reportID) || parser.htmlToMarkdown(lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '')).trim(), |
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.
We forgot to trim the value acquired from Report.getDraftPrivateNote
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.
@DylanDylann can you spin up a PR to fix this? 🙏🏼
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.
@MariaHCD @robertKozik Sorry for the wait there. I am working on it now
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.
#30357 PR is ready for review @robertKozik
Coming from #30076. The draft value should be cleared when the save button is pressed. |
Details
[Feature Request] Pressing back while writing notes makes text disappear
Fixed Issues
$ #28599
PROPOSAL: #28599 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screencast.from.10-10-2023.12.56.09.webm
Android: mWeb Chrome
private-chrome-android.mp4
iOS: Native
ios.mov
iOS: mWeb Safari
Mios.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
deks.mov