Repository navigation
[HOLD for payment 2024-04-15] [$250] Task - No error of exceeding limit when changing title of existing task & system message posted #38451
Description
Activity
- addedDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Mar 17, 2024 We think that this bug might be related to #vip-vsp
Proposal
Please re-state the problem that we are trying to solve in this issue.
Task - No error of exceeding limit when changing title of existing task & system message posted
What is the root cause of that problem?
We don't have logic in validate function to check task title length and show error on task edit page.
App/src/pages/tasks/TaskTitlePage.tsx
Lines 31 to 39 in c915e7f
const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => { const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {}; if (!title) { errors.title = 'newTaskPage.pleaseEnterTaskName'; } return errors; }, []); What changes do you think we should make in order to solve the problem?
Update the validate function to also check for length just like we do in
NewTaskTitlePage.
App/src/pages/tasks/NewTaskTitlePage.tsx
Lines 38 to 49 in c915e7f
const validate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.NEW_TASK_FORM> => { const errors = {}; if (!values.taskTitle) { // We error if the user doesn't enter a task name ErrorUtils.addErrorMessage(errors, 'taskTitle', 'newTaskPage.pleaseEnterTaskName'); } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; }; Pseudo-code:
const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => { const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {}; if (!title) { ErrorUtils.addErrorMessage(errors, INPUT_IDS.TITLE, 'newTaskPage.pleaseEnterTaskName'); } else if (title.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, INPUT_IDS.TITLE, ['common.error.characterLimitExceedCounter', {length: title.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; }, []);
Result
Proposal
Please re-state the problem that we are trying to solve in this issue.
No error of exceeding limit when changing title of existing task & system message posted
What is the root cause of that problem?
We have a check in the edit title page only when the title is empty but not when the character length is more than 100 characters:
App/src/pages/tasks/TaskTitlePage.tsx
Lines 31 to 39 in c915e7f
const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => { const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {}; if (!title) { errors.title = 'newTaskPage.pleaseEnterTaskName'; } return errors; }, []); What changes do you think we should make in order to solve the problem?
Update the Validate function to check for character length as follows:
Note
We don't need to use
ErrorUtilsover here, this is a unnecessary function call and redundant, using local valuetitlewill be more efficient and fast. Also we have already defined the type of the errorsFormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>, so no need to useErrorUtilsconst validate = useCallback(({ title }: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => { const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {}; if (!title) { errors.title = 'newTaskPage.pleaseEnterTaskName'; } else if (title?.length > CONST.TITLE_CHARACTER_LIMIT) { errors.title = ['common.error.characterLimitExceedCounter', { length: title.length, limit: CONST.TITLE_CHARACTER_LIMIT }]; } return errors; }, []);
Result
simplescreenrecorder-2024-03-18_02.55.44.mp4
@lanitochka17 No one was assigned to this task, can you reapply the labels please :) thanks
- addedBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2and removedDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Mar 18, 2024 Triggered auto assignment to @kevinksullivan (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.@kevinksullivan FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
I would put this in VIP-VSB, since it's tied to task management. I would put this as a LOW issue in terms of priority though, because this is only an issue AFTER the task is created, and the error works well when creating the task with > 100 characters
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Mar 19, 2024 52 remaining items
Payment summary:
- @thesahindia - $250
- @Krishna2323 - $250 (completed in NewDot)
@thesahindia please complete the checklist above and we can close this out, thanks!
@blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Huh... This is 4 days overdue. Who can take care of this?
The logic for validation was missing. I don't think we need a regression test case here.
Reacted by Benjamin Limpich@blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
$250 approved for @thesahindia
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsLOW
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.53-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
The error is displayed in the title editor that the field is exceeding limit of 100 characters, and user can not save the long title
Actual Result:
The error is not displayed in in the title editor, the title gets updated briefly, user is returned to the task report, and the system message of updated title is posted. There is only one error message in the task report that the title is too long
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6416034_1710604494395.Recording__291.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @thesahindia