-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add Task Title Validation on Main Composer Text Change #52941
Merged
marcaaron
merged 27 commits into
Expensify:main
from
wildan-m:wildan/fix/50398-fix-max-length-validation-for-task
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9c825da
Add task specific max length validation
wildan-m bd3a70e
remove unnecessary comment
wildan-m bee1a66
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m faf4370
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m bcbde08
put most logic to useHandleExceedMaxCommentLength
wildan-m 0e5325d
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m f90ce91
Use separate hooks to validate max title length
wildan-m a3bd4bf
add hasExceededMaxTitleLength dependency
wildan-m 3d40a79
change debounce time to const
wildan-m dd65326
change exceededMaxLength to state
wildan-m cb37156
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m 2c3b86d
Update src/CONST.ts
wildan-m 708adbf
Use separate text for task title validation message
wildan-m 0c20987
Merge branch 'wildan/fix/50398-fix-max-length-validation-for-task' of…
wildan-m 5c51ae8
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m ed1b95d
Update src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx
wildan-m 867f77b
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m c3c0796
Refactor
wildan-m 58bbcbe
refactor for better readability
wildan-m 36253a8
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m 41c3215
extract debounce, refactor
wildan-m 3f08b65
Remove unnecessary state
wildan-m dc57914
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m ad2272d
resolve performance issue
wildan-m e638474
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m e63f27a
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m 36e4c3e
Add optional chain
wildan-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {useCallback, useState} from 'react'; | ||
import CONST from '@src/CONST'; | ||
|
||
const useHandleExceedMaxTaskTitleLength = () => { | ||
const [hasExceededMaxTaskTitleLength, setHasExceededMaxTitleLength] = useState(false); | ||
|
||
const validateTaskTitleMaxLength = useCallback((title: string) => { | ||
const exceeded = title ? title.length > CONST.TITLE_CHARACTER_LIMIT : false; | ||
setHasExceededMaxTitleLength(exceeded); | ||
}, []); | ||
|
||
return {hasExceededMaxTaskTitleLength, validateTaskTitleMaxLength, setHasExceededMaxTitleLength}; | ||
}; | ||
|
||
export default useHandleExceedMaxTaskTitleLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
instead of creating a new state isCreatingTaskComment, should we reset hasExceededMaxCommentLength=false here. Also set hasExceededMaxTaskTitleLength in below condition.
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.
@hoangzinh sure, updated
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.
Not sure why
perf-tests
failed, it pass in localThere 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.
forgot to set baseline, here is the result
@hoangzinh do you know what that means? It seems our change is causing extra rendering, right?
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.
It can be because our new deboundValidate haven't been wrapped in useCallback?
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 see it's because of useDebounce is not ready yet when reload the page. Okay, let back to use useMemo and useCallback.
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.
@hoangzinh We still utilize lodashDebounce. please let me know if you have other feedback
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.
ah yes, it's correct. I'm assuming it would be same as #52941 (comment)
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.
@hoangzinh bump
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.
oops sorry, I thought this PR was not ready for next review. I will review it today