Closed izarutskaya closed 5 months ago
Triggered auto assignment to @Christinadobrzyn (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~0102b1c7f6c3df6359
Platforms
in OP are β
)Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External
)
Year change by months does not change selection
When we add a month (here) to selected date or move to previous (here) we only modify the currentDateView state and isSelected
field in years state is not changed when year is also changes
we need to change selected year in years state when year is added(move to next month) or subtracted(moveToprevMonth)
/**
* Handles the user pressing the previous month arrow of the calendar picker.
*/
moveToPrevMonth() {
this.setState((prev) => {
const prevMonth = subMonths(new Date(prev.currentDateView), 1);
// if year is subtracted, we need to update the years list
let newYears = prev.years;
if (prevMonth.getFullYear() < prev.currentDateView.getFullYear()) {
newYears = _.map(prev.years, (item) => ({
...item,
isSelected: item.value === prevMonth.getFullYear(),
}));
}
return {
...prev,
currentDateView: prevMonth,
years: newYears,
};
});
}
/**
* Handles the user pressing the next month arrow of the calendar picker.
*/
moveToNextMonth() {
this.setState((prev) => {
const nextMonth = addMonths(new Date(prev.currentDateView), 1);
// if year is added, we need to update the years list
let newYears = prev.years;
if (nextMonth.getFullYear() > prev.currentDateView.getFullYear()) {
newYears = _.map(prev.years, (item) => ({
...item,
isSelected: item.value === nextMonth.getFullYear(),
}));
}
return {
...prev,
currentDateView: nextMonth,
years: newYears,
};
});
}
Settings - Year change by months does not change selection
The main problem is that the selected year changes thanks only to onYearSelected
which call only when we set year
Instead of duplicating the logic for changing the selected year, we can simply add a listener
We can add new useEffect which will listen currentYear
for YearPickerModal when our modal is not visible
useEffect(() => {
if (!props.isVisible) {
props.onYearChange(props.currentYear);
}
}, [props.currentYear, props.isVisible]);
As alternative we can use componentDidUpdate
inside CalendarPicker
componentDidUpdate(prevProps, prevState) {
if (this.state.currentDateView.getFullYear() !== prevState.currentDateView.getFullYear()) {
this.onYearSelected(this.state.currentDateView.getFullYear());
}
}
I can reproduce this - I think it's a low priority but I think it could be part of [ECARD] LOW: Settings - Remove unnecessary requirement for dateOfBirth when creating physical cards in Marqeta#316704
Adding it to that Wave to evaluate this change!
@Christinadobrzyn i think we should treat this as normal priorty issue because the Calendar component is widely used in app, in bank account flow, money request and date of birth, and it looks like visual inconsistency which feels broken, user may encounter this in a normal flow of using app
Settings - Year change by months does not change selection
CalendarPicker
we store years but did not use it in CalendarPicker
, we just pass it to YearPickerModal
. So it can make our component re-renders unexpectedly isSelected
here, but when year changes by months, we did not call onYearSelected
so years
sections is not updatedyears
in CalendarPicker
, because we did not use it in CalendarPicker
. We should calculate years
in YearPickerModal
. We will pass minYear
, maxYear
instead of years
years
in YearPickerModal
, we check isSelected=value === props.currentYear
so we can make sure the currentYear
will be selected const initialYears = useRef(_.map(
Array.from({length: props.maxYear - props.minYear + 1}, (v, i) => i + props.minYear),
(value) => ({
text: value.toString(),
value,
keyForList: value.toString(),
}),
))
const years = useMemo(()=>{
return _.map(
initialYears.current,
(year) => ({
...year,
isSelected: year.value === props.currentYear,
}),
)
},[props.currentYear])
https://github.com/Expensify/App/assets/113963320/5dcd56ef-7cfa-4e4b-99dc-c9aee0fe4fcd
Hi @ishpaul777 it looks like this job will be treated with our normal priority.
@mollfpr feel free to evaluate the provided proposal to see if any will work. Thanks!
I think it could be part of https://github.com/Expensify/Expensify/issues/316704
FWIW this is unrelated
@mollfpr, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick!
I feel the proposal from @ishpaul777 is the correct way to handle this issue. It makes it easier to maintain the prev/next month's function.
π π π C+ reviewed!
Triggered auto assignment to @danieldoglas, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
π£ @mollfpr π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @ishpaul777 π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
still working on a review - @danieldoglas when you have a moment can you check on this decision - https://github.com/Expensify/App/issues/33006#issuecomment-1859715285
@Christinadobrzyn, I think we already let @ishpaul777 work on the issue. We need to wait for the PR to be ready.
hi @mollfpr just checking on the PR review!
@Christinadobrzyn Yup, working on it!
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.23-4 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-01-17. :confetti_ball:
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
https://github.com/Expensify/App/pull/21792
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
https://github.com/Expensify/App/pull/21792/files#r1457723732
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
The regression step should be enough.
[@mollfpr] Determine if we should create a regression test for this bug. [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
@Christinadobrzyn Could you give the payment summary for the manual request in NewDot? Thank you!
Just awaiting payment, not overdue. cc @Christinadobrzyn
Sorry for the delay here
Regression test here- https://github.com/Expensify/Expensify/issues/363007
Payouts due:
Issue Reporter: NA Contributor: $500 @ishpaul777 (Paid in Upwork) Contributor+: $500 @mollfpr - you get paid in NewDot or Upwork?
Eligible for 50% #urgency bonus? NA
Upwork job is here. The upwork job is now closed so let me know if you need payment through Upwork and I'll create a new job
Thanks @Christinadobrzyn I'll request the payment in NewDot.
$500 approved for @mollfpr based on summary above.
awesome! I think we're good to close this. Thanks all!
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: v1.4.12-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: Slack conversation: @
Action Performed:
Expected Result:
App should change background color as well as green tick position for the selected or current calendar year
Actual Result:
App changes background color but does not change green tick position on change of year value by changing months value in calendar
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/Expensify/App/assets/115492554/487e5060-ac97-425c-afd1-aa057e146c64
View all open jobs on GitHub
Upwork Automation - Do Not Edit