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-06-20] [$125] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover #43412

Closed
luacmartins opened this issue Jun 10, 2024 · 12 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2

Comments

@luacmartins
Copy link
Contributor

luacmartins commented Jun 10, 2024

Coming from this thread, the hover styles are not being applied when the mouse exists the row item.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014338cee918b85ec5
  • Upwork Job ID: 1800226670096480396
  • Last Price Increase: 2024-06-10
Issue OwnerCurrent Issue Owner: @anmurali
@luacmartins luacmartins added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 10, 2024
@luacmartins luacmartins self-assigned this Jun 10, 2024
Copy link

melvin-bot bot commented Jun 10, 2024

Triggered auto assignment to @anmurali (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.

@luacmartins luacmartins added the External Added to denote the issue can be worked on by a contributor label Jun 10, 2024
Copy link

melvin-bot bot commented Jun 10, 2024

Job added to Upwork: https://www.upwork.com/jobs/~014338cee918b85ec5

@melvin-bot melvin-bot bot changed the title [Search v1] Receipt thumbnail background doesn't change back to correct color after hover [$250] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover Jun 10, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 10, 2024
@luacmartins luacmartins changed the title [$250] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover [$125] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover Jun 10, 2024
Copy link

melvin-bot bot commented Jun 10, 2024

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

Copy link

melvin-bot bot commented Jun 10, 2024

Upwork job price has been updated to $125

@ishpaul777
Copy link
Contributor

Proposal

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

Receipt thumbnail background doesn't change back to correct color after hover

What is the root cause of that problem?

This comes from #42823, Here we are using a useHover hook

const {hovered, bind} = useHover();

which sets onMouseLeave event.

onMouseLeave: () => setHovered(false),

and then we also set onMouseLeave event here which overwrites the above event so the hover logic fails to work.

onMouseUp={handleMouseUp}
onMouseLeave={handleMouseUp}

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

Presently there are 2 different places that are handling the mousevents this leads to this bug, to solve this I propose we integrate useMouseContext and useHoverHook in one hook called useMouseEvents.

we'll use the hook like below:

    const {isMouseDownOnInput, bindMouseEvents, isHovered} = useMouseEvents();
    // rest of code
    ..
    ..
    ..
    <PressableWithFeedback
        // eslint-disable-next-line react/jsx-props-no-spreading
        {...bindMouseEvents(true, true)}
    // rest of code 
//hooks/useMouseEvents.tsx

import type React from 'react';
import {useState} from 'react';

function useMouseEvents() {
    const [isMouseDownOnInput, setIsMouseDownOnInput] = useState(false);
    const [isHovered, setIsHovered] = useState(false);

    const setMouseDown = () => setIsMouseDownOnInput(true);
    const setMouseUp = () => setIsMouseDownOnInput(false);

    const bindMouseEvents = (shouldStopPropagationOnMouseDown = false, shouldStopPropagationOnMouseUp = false) => ({
            onMouseUp: (e: React.MouseEvent<Element, MouseEvent>) => {
                if (shouldStopPropagationOnMouseUp) {
                    e.stopPropagation();
                }
                setMouseUp();
            },
            onMouseEnter: () => setIsHovered(true),
            onMouseLeave: (e: React.MouseEvent<Element, MouseEvent>) => {
                if (shouldStopPropagationOnMouseDown) {
                    e.stopPropagation();
                }
                setIsHovered(false);
                setIsMouseDownOnInput(true);
            }
    });

    return {isMouseDownOnInput, setMouseDown, setMouseUp, bindMouseEvents, isHovered}
}



export default useMouseEvents;

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jun 10, 2024
@eh2077
Copy link
Contributor

eh2077 commented Jun 11, 2024

@luacmartins I think this has been fixed in #43424 right?

@luacmartins
Copy link
Contributor Author

luacmartins commented Jun 11, 2024

Yes, it was. Thanks. Closing!

@ishpaul777
Copy link
Contributor

hello @luacmartins, the root cause for this issue is still unfixed there might still be unidentified hover issues...

@luacmartins
Copy link
Contributor Author

Do you have an example of an existing issue?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 13, 2024
@melvin-bot melvin-bot bot changed the title [$125] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover [HOLD for payment 2024-06-20] [$125] [Search v1] Receipt thumbnail background doesn't change back to correct color after hover Jun 13, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

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

Copy link

melvin-bot bot commented Jun 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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-06-20. 🎊

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

  • @eh2077 requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jun 13, 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:

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

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. External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

4 participants