Open m-natarajan opened 2 months ago
@rushatgabhane if you could please take a look when you get a chance
@rushatgabhane, @jliexpensify, @MonilBhavsar Huh... This is 4 days overdue. Who can take care of this?
Bumping @rushatgabhane here!
@rushatgabhane, @jliexpensify, @MonilBhavsar 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
Am going to DM @rushatgabhane on Slack
hello! i still think that we should assign @ChavdaSachin because their proposal was first (and meets all the requirements)
@rushatgabhane That solution does not fix the case we click on "import spreadsheet" on other pages such as the categories, tags pages
https://github.com/user-attachments/assets/1bd6cf89-b641-4bf0-8c58-f100ed836072
@truph01 could you please add steps and what you expect to happen, so that we're on the same page
I have already provided solution for the same here cc. @rushatgabhane
i feel that we should just go with @ChavdaSachin's proposal and any minor issues can be ironed out in the PR
In the future, If we introduce a new component like "Import spreadsheet" button (click on it will navigate to other screen), the bug will appear again.
i feel that we should just go with @ChavdaSachin's proposal and any minor issues can be ironed out in the PR
Also, do you have any feedback about my proposal? So I can improve it in other issues. Thanks
Also, do you have any feedback about my proposal? So I can improve it in other issues. Thanks
@truph01
@ChavdaSachin pointed out an issue in your proposal here. So I felt it did not meet the requirements.
selections should not clear after taping raw selection should be cleared upon visiting other pages like Tags, Workflow, etc... and coming back
@rushatgabhane I`ve updated my proposal via comment here to match that requirement.
selections should not clear after taping raw selection should be cleared upon visiting other pages like Tags, Workflow, etc... and coming back
Maybe you miss that comment.
i know, you have updated but @ChavdaSachin was the one to point it and fix it. So I consider their proposal as the one that came first.
Ah, I’m a newbie, and I think we should consider the advantages each solution brings to the app, in addition to the order of the proposals.
However, it seems we tend to choose the first solution that resolves the issue, even if the second one is more general and robust. I'll keep that in mind for future proposals. Thanks!
Pr Draft is ready, I have checked functionality thoroughly, and will upload videos in few hours. cc. @rushatgabhane @MonilBhavsar
PR ready for review. cc. @rushatgabhane @MonilBhavsar
@ChavdaSachin please wait until the assignment
@MonilBhavsar FYI, C+ has chosen proposal based on comment. Just wait for your final review.
If possible, please take a look at my proposal as well. FYI, both proposals are nearly the same, except for how they handle the following:
selections should not clear after taping raw selection should be cleared upon visiting other pages like Tags, Workflow, etc... and coming back
Yep, a long discussion in this issue https://github.com/Expensify/App/pull/40136 And, we concluded that selection should be cleared when navigated away
Thanks for linking Monil
@truph01 Linking a POC or test branch would have been helpful to verify such proposals
@MonilBhavsar Thanks. The test branch for the solution here: https://github.com/truph01/App/tree/fix/49322.
@MonilBhavsar 2 more input from my side.
These pages store selected item list as array while the new hook only covers the case if list is stored as object
const useCleanupSelectedOptions = (setFunction: ({}: any) => void) => {
we can pass the cleanup function:
const useCleanupSelectedOptions = (cleanupFunction: () => void) => {
rather than modifying navigation function
@rushatgabhane @jliexpensify @MonilBhavsar this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@MonilBhavsar - just a heads up, I'm OOO from 3rd to 14th, but I don't think anything is needed from me during this period. Feel free to reassign to another B0 if needed though!
I have found additional case of possible regression,
If we preserve selections and delete category from categorySettingsPage, selection counter on header would not update.
https://github.com/user-attachments/assets/4d8b42a9-9e86-4f85-9dfb-2562fa7f6879
So for that problem - In addition to My Proposal we need to include a new function - refreshSelection
const refreshSelection = () => {
const availableCategories = categoryList.filter((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
setSelectedCategories(Object.fromEntries(availableCategories.map((item) => Object.keys(selectedCategories).includes(item.keyForList) ? [item.keyForList, true]: [])));
}
and make a function call on focus.
useEffect(() => {
if (isFocused || shouldPreserveSelection) {
setShouldPreserveSelection(false);
refreshSelection();
return;
}
setSelectedCategories({});
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [isFocused]);
@ChavdaSachin @truph01 Thanks so much for digging into the root cause and proposing solutions to fix this bug! After reviewing, It looks like that combining both of your solutions would get us to the complete, efficient and scalable fix. A good instance to showcase team work and work on this bug together!?
We would like to fix this issue happening for all pages and all instances as pointed by @ChavdaSachin While we also want to make it scalable by simply creating a hook and using it in the new similar page we might create in future, as proposed by @truph01
Would you be up for teaming up to work on this issue together? If so, we'll split the bounty between both of you.
Please comment here and let us know if you're down to collaborate!
Alright I am in.👍
@MonilBhavsar I’m happy to have a team collaborate on this issue if both proposals contribute to resolving the bugs. But here is my thoughts about the bug:
"If we preserve selections and delete category from categorySettingsPage, selection counter on header would not update."
I don't believe this is a regression, as the bug existed before. If you try selecting 3 categories in one tab, then try to delete one of them in another device/browser, the counter doesn't update correctly as well. This happens because we don't have a mechanism in place to automatically update the header counter when a category is deleted.
The solution suggested here seems more like a workaround, as the useEffect is only triggered when isFocused
changes. As a result, it cannot fix the case I mentioned above.
If we still want to fix that bug in this issue, I think we need to create a new hook so that we can use it in other pages:
import {useEffect} from 'react';
import {ListItem} from '@components/SelectionList/types';
const useAutoUdpateSelectedOptions = (listItem: ListItem[], selectedOptions: Record<string, boolean>, setSelectedOptions: React.Dispatch<React.SetStateAction<Record<string, boolean>>>) => {
useEffect(() => {
const availableOptions = listItem.filter((o) => !o.isDisabled).map((o) => o.text);
const originalSelectedOptions = Object.keys(selectedOptions);
const newSelectedOptions = originalSelectedOptions.filter((o) => availableOptions.includes(o));
setSelectedOptions(
newSelectedOptions.reduce((acc, key) => {
acc[key] = true;
return acc;
}, {}),
);
}, [listItem]);
};
export default useAutoUdpateSelectedOptions;
It will auto-update the selected options once the options change.
then use it in workspace category page or other similar pages:
useAutoUdpateSelectedOptions(categoryList, selectedCategories, setSelectedCategories);
Hi @MonilBhavsar - I'm back, anything needed from me? Also, looks like we have this comment to be addressed, especially around payment. It seems like it could be a big job so happy to consider an increase - thoughts?
@rushatgabhane @jliexpensify @MonilBhavsar this issue is now 4 weeks old, please consider:
Thanks!
@MonilBhavsar What do you think about my thoughts?
This issue has not been updated in over 15 days. @rushatgabhane, @jliexpensify, @MonilBhavsar 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!
Bumping @MonilBhavsar for a review!
@MonilBhavsar Please help take a look at this issue once you have a chance. Thanks
@MonilBhavsar Please take a look at my comment when you have a chance. Thanks
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: 9.0.36-1 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: @rushatgabhane Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1725906909191599
Action Performed:
Expected Result:
RHP opened for selected category and other category remain selected
Actual Result:
RHP opened for the category and all other categories are reset (Unchecked)
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/user-attachments/assets/c70804b4-fad5-4664-9503-65335a48dd4a
https://github.com/user-attachments/assets/28f50025-55a1-4324-a1c6-5318a074ad3f
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Issue Owner
Current Issue Owner: @rushatgabhane