Skip to content
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

[HOLD for payment 2024-07-10] Android & iOS - Tags - "Enabled" badge is not crossed out when tag is deleted offline #42673

Closed
2 of 6 tasks
lanitochka17 opened this issue May 27, 2024 · 40 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented May 27, 2024

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.76-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: https://expensify.testrail.io/index.php?/tests/view/4578912
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to workspace settings
  3. Go to Tags
  4. Add a tag if there is no tag
  5. Go offline
  6. Delete the tag

Expected Result:

The "Enabled" badge will be crossed out when tag is deleted offline (web behavior)

Actual Result:

The "Enabled" badge is not crossed out when tag is deleted offline
This issue also applies to categories, distance rates and tax rates

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6493365_1716844680187.RPReplay_Final1716844369.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @JmillsExpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 27, 2024
Copy link

melvin-bot bot commented May 27, 2024

Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@JmillsExpensify 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@Krishna2323
Copy link
Contributor

Krishna2323 commented May 27, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Android & iOS - Tags - "Enabled" badge is not crossed out when tag is deleted offline

What is the root cause of that problem?

The deleted style is only applied to direct child of OfflineWithFeedback, but in we are using ListItemRightCaretWithLabel for the label.


rightElement: <ListItemRightCaretWithLabel labelText={tag.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')} />,

What changes do you think we should make in order to solve the problem?

We need to follow the same approach as we did in #39010.

  1. Get the style prop in ListItemRightCaretWithLabelProps.
  2. Determine the value of isDeleted.
const isDeleted = style && Array.isArray(style) ? style.includes(styles.offlineFeedback.deleted) : false;
  1. Use isDeleted to style the text correctly.

We will also look for similar components like ListItemRightCaretWithLabelProps.

What alternative solutions did you explore? (Optional)

Result

enabledTextNot_crossed.mp4

@bernhardoj
Copy link
Contributor

bernhardoj commented May 28, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Enabled badge of the right component is not crossed out when deleting a tag while offline.

What is the root cause of that problem?

The crossed out style is applied from OfflineWithFeedback. OfflineWithFeedback will give the component a deleted style.

const props: StrikethroughProps = {
style: StyleUtils.combineStyles(childProps.style, styles.offlineFeedback.deleted, styles.userSelectNone),
};

However, the Enabled badge component itself doesn't accept any style props.

function ListItemRightCaretWithLabel({labelText, shouldShowCaret = true}: ListItemRightCaretWithLabelProps) {

So, the deleted style is never applied to it.

What changes do you think we should make in order to solve the problem?

Add a style prop to ListItemRightCaretWithLabel and append it to the label text style here.

{!!labelText && <Text style={[styles.alignSelfCenter, styles.textSupporting, styles.pl2, styles.label]}>{labelText}</Text>}

What alternative solutions did you explore? (Optional)

We can start passing an additional offlineFeedbackStyle prop from OfflineWithFeedback and use it on a custom component, in our case, the ListItemRightCaretWithLabel. Other components will still work as usual.

style: StyleUtils.combineStyles(childProps.style, styles.offlineFeedback.deleted, styles.userSelectNone),
offlineFeedbackStyle: StyleUtils.combineStyles(styles.offlineFeedback.deleted, styles.userSelectNone),

Then we accept offlineFeedbackStyle as the new prop of ListItemRightCaretWithLabel instead of style.

@melvin-bot melvin-bot bot added the Overdue label May 29, 2024
@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label May 30, 2024
Copy link

melvin-bot bot commented May 30, 2024

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 30, 2024
@JmillsExpensify
Copy link

Opening up to the community.

Copy link

melvin-bot bot commented May 30, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)

@tienifr
Copy link
Contributor

tienifr commented May 30, 2024

My solution here is a general fix for issues like this, I'll post it again here in some time

@tienifr
Copy link
Contributor

tienifr commented Jun 4, 2024

Bringing my proposal from #37776 which is a general fix

Proposal

Please re-state the problem that we are trying to solve in this issue.

"Enabled" badge is not crossed out when tag is deleted offline

What is the root cause of that problem?

In here, we already attempted to apply strikethrough text style for all nested children of OfflineWithFeedback.tsx

This works well in case of direct children like here, it will have style appended with the strike through style here. That's why the display name and email of the workspace member have strike-through style correctly.

However, the children recursive search logic will not work in case the Text is nested inside another custom component like the Badge here. In this case, when iterating here, the children of Badge element will be undefined, because children only works for elements directly exposed inside the children of OfflineWithFeedback.tsx. This leads to the Text (a child in Badge structure) not having the strike-through style applied.

And this issue will happen again any time we have a Text that's deeply nested inside OfflineWithFeedback, a very common use case.

What changes do you think we should make in order to solve the problem?

The challenge is: Apply strike-through style to all Text components inside OfflineWithFeedback.

We need to use a more robust approach to do this than recursive search on children, due to the limitation above.

Fortunately, we already have a similar app-wide pattern which is the useTheme that can be done similarly for this case:

  1. Wrap the children of OfflineWithFeedback here inside a CustomStyleContext.Provider (similar to how we use a ThemeProvider), this provider will provide the strikethrough-related style as the value. This can be used for any use cases where we want all sub-components to follow the same styles, just like this case where we want all Text inside OfflineWithFeedback to have strikethrough style.
  2. create a useCustomStyle hook, similar to the useTheme hook, that returns the style defined in the provider, if there's no Provider, simply return undefined/empty object
  3. In Text here, use the useCustomStyle hook and adds the style gotten from there to componentStyle

This pattern is similar to the theme pattern we're already using and is much more robust than the recursive-children approach currently being used. And any use case of we want all sub-components to follow the same styles can use this same provider and hook.

What alternative solutions did you explore? (Optional)

NA

@melvin-bot melvin-bot bot added the Overdue label Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

@JmillsExpensify, @DylanDylann Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify
Copy link

Still waiting for proposal review. cc @DylanDylann

@DylanDylann
Copy link
Contributor

This issue only reproduces on the native app. I think the RCA will be more complicated than the above proposals

However, the children recursive search logic will not work in case the Text is nested inside another custom component like the Badge here. In this case, when iterating here, the children of Badge element will be undefined, because children only works for elements directly exposed inside the children of OfflineWithFeedback.tsx. This leads to the Text (a child in Badge structure) not having the strike-through style applied.

@tienifr Thanks for this point. But it is still grey to me, I will need some time to dive deep into this problem. It would be great if you could detail more

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2024
@tienifr
Copy link
Contributor

tienifr commented Jun 6, 2024

@DylanDylann Please read this thread for more details: https://stackoverflow.com/q/51776533

Basically, when we have:

<ComponentA>
    <ComponentB>
         <ComponentC/>
    </ComponentB>
</ComponentA>

And we try to access the children of ComponentB, we'll see ComponentC is a children

But when we do

<ComponentA>
    <ComponentB />
</ComponentA>

and

ComponentB = <View>
     <ComponentC/>
</View>

children of ComponentB will be empty, because it indeeds have no children (no elements within the <ComponentB> and </ComponentB> closing and ending tags)

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added the Overdue label Jun 10, 2024
Copy link

melvin-bot bot commented Jun 10, 2024

@JmillsExpensify @DylanDylann 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!

Copy link

melvin-bot bot commented Jun 10, 2024

@JmillsExpensify, @DylanDylann Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot changed the title Android & iOS - Tags - "Enabled" badge is not crossed out when tag is deleted offline [HOLD for payment 2024-07-10] Android & iOS - Tags - "Enabled" badge is not crossed out when tag is deleted offline Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-10. 🎊

For reference, here are some details about the assignees on this issue:

  • @tienifr requires payment through NewDot Manual Requests
  • @DylanDylann requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jul 3, 2024

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:

  • [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
  • [@DylanDylann] 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:
  • [@DylanDylann] 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:
  • [@DylanDylann] Determine if we should create a regression test for this bug.
  • [@DylanDylann] 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.
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

Payment Summary

Upwork Job

BugZero Checklist (@JmillsExpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@JmillsExpensify
Copy link

@tienifr mind filling out the BZ checklist? I confirm the $250 payment summary above is correct for both contributors.

@JmillsExpensify
Copy link

@DylanDylann shall I create an Upwork job/contract for you?

@DylanDylann
Copy link
Contributor

@JmillsExpensify Yes please!

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

@JmillsExpensify, @youssef-lr, @tienifr, @DylanDylann Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@JmillsExpensify
Copy link

@DylanDylann offer sent!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 16, 2024
@JmillsExpensify
Copy link

Reminder on the Upwork contract!

@melvin-bot melvin-bot bot removed the Overdue label Jul 19, 2024
@DylanDylann
Copy link
Contributor

@JmillsExpensify Sure thing, I accepted the offer, TY

@JmillsExpensify
Copy link

All paid out! @tienifr I'm going to close this issue for now, though before you submit an expense via New Expensify, please make sure to complete the BZ checklist.

@tienifr
Copy link
Contributor

tienifr commented Aug 5, 2024

I believe it'd be on @DylanDylann to complete the BZ checklist. @DylanDylann Could you help with that?

I've requested payment via NewDot

@DylanDylann
Copy link
Contributor

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:

[@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
[@DylanDylann] 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: NA
[@DylanDylann] 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: NA
[@DylanDylann] Determine if we should create a regression test for this bug. Yes
[@DylanDylann] 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.

Regression Test Proposal

  1. Go to workspace settings
  2. Go to Tags
  3. Add several tags if there is no tag
  4. Go offline
  5. Delete the tags
  6. Verify the tag and "Enabled" badge will be crossed out when the tag is deleted offline
  7. Go online
  8. Verify the tags disappear

Do we agree 👍 or 👎

@JmillsExpensify
Copy link

Ah thanks! I'll re-open this one.

@JmillsExpensify
Copy link

@mallenexpensify would you mind double-confirming payment summary before I approve payment?

@mallenexpensify
Copy link
Contributor

Contributor: @DylanDylann paid $250 via Upwork
Contributor+: @tienifr owed $250 via NewDot

@JmillsExpensify
Copy link

$250 approved for @tienifr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

9 participants