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-01-18] [HIGH] Clean up Hoverable component #32096

Closed
mountiny opened this issue Nov 28, 2023 · 35 comments
Closed

[HOLD for payment 2024-01-18] [HIGH] Clean up Hoverable component #32096

mountiny opened this issue Nov 28, 2023 · 35 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production NewFeature Something to build that is a new item. Weekly KSv2

Comments

@mountiny
Copy link
Contributor

mountiny commented Nov 28, 2023

Coming from here

Problem

Hoverable definition contains mixed logic of a few states (disabled , scrolling, hasHoverSupport), which makes it harder to understand and maintain.

Solution

Here is a list of issues with potential improvements that could help with that:

  1. Logic responsible for internal updates is interleaved with logic responsible for disabled and hoveredEnabled states of the component. This may lead to hard-to-spot bugs.
    • Split the component into two distinct paths, InactiveHoverable and ActiveHoverable (see linked PR). This way we don't care about handling the disabled logic inside actual Hoverable
  2. Component children definition is not strict enough causing complicated logic for child retrieval
    • Component should only accept single ReactElement child or callback that returns such single child - if more than one element is needed to have a hovered mechanism, then wrap them into a mutual parent
  3. Component subscribes to unnecessary events, such as onBlur - if Hoverable should be responsible for focus effects as well, it should be taken into account explicitly
    • Let’s discuss if we could safely remove the subscription to onBlur
  4. There are two pairs of callbacks onHover* and onMouse* which distinction and role are not clearly visible (they are not the same but I am not sure if we need the distinction, e.g. onMouse* event can be taken directly from children passed to Hoverable)
    • Discuss if we could simplify it, so only one pair is needed (see linked PR)
  5. There are a lot of Hoverable components on the page (lists’ items etc.) and each of them subscribes to scrolling event
    • Is there an alternative way for what we currently have?
Issue OwnerCurrent Issue Owner: @MitchExpensify
@mountiny mountiny added Daily KSv2 NewFeature Something to build that is a new item. labels Nov 28, 2023
Copy link

melvin-bot bot commented Nov 28, 2023

@melvin-bot melvin-bot bot added the Weekly KSv2 label Nov 28, 2023
@melvin-bot melvin-bot bot removed the Daily KSv2 label Nov 28, 2023
@mountiny mountiny assigned mountiny and unassigned lschurr Nov 28, 2023
@mountiny
Copy link
Contributor Author

cc @kacper-mikolajczak can you please comment here

@kacper-mikolajczak
Copy link
Contributor

Hi @mountiny , I would like to work on this issue

@mountiny mountiny added the Reviewing Has a PR in review label Nov 28, 2023
@mountiny
Copy link
Contributor Author

PR is in a review

@cubuspl42
Copy link
Contributor

cubuspl42 commented Nov 28, 2023

  • Logic responsible for internal updates is interleaved with logic responsible for disabled and hoveredEnabled states of the component. This may lead to hard-to-spot bugs.

    • Split the component into two distinct paths, InactiveHoverable and ActiveHoverable (see linked PR). This way we don't care about handling the disabled logic inside actual Hoverable

  • Component children definition is not strict enough causing complicated logic for child retrieval

@kacper-mikolajczak Would you say a word or two about how this requirement was met?

  • Component should only accept single ReactElement child or callback that returns such single child - if more than one element is needed to have a hovered mechanism, then wrap them into a mutual parent

  • Component subscribes to unnecessary events, such as onBlur - if Hoverable should be responsible for focus effects as well, it should be taken into account explicitly
    • Let’s discuss if we could safely remove the subscription to onBlur

@kacper-mikolajczak Analogically. Could we safely remove the subscription to onBlur?

  • There are two pairs of callbacks onHover* and onMouse* which distinction and role are not clearly visible (they are not the same but I am not sure if we need the distinction, e.g. onMouse* event can be taken directly from children passed to Hoverable)

    • Discuss if we could simplify it, so only one pair is needed (see linked PR)

Done

  • There are a lot of Hoverable components on the page (lists’ items etc.) and each of them subscribes to scrolling event

    • Is there an alternative way for what we currently have?

@kacper-mikolajczak Analogically. Is there an alternative way for what we currently have?

@kacper-mikolajczak
Copy link
Contributor

kacper-mikolajczak commented Nov 28, 2023

Component children definition is not strict enough causing complicated logic for child retrieval
Would you say a word or two about how this requirement was met?

The requirement has been already met after refactoring the component to TS. In this PR we simply removed unnecessary mapChildren function which indicated that the component can receive multiple children. Also, the TS typings for child was corrected.

Analogically. Could we safely remove the subscription to onBlur?
After the discussion, we decided not to remove the onBlur handler as it might revive old issues.

Analogically. Is there an alternative way for what we currently have?
Unfortunately, no findings on this one.

@cubuspl42 Let me know if that answered your concerns 👍

@cubuspl42
Copy link
Contributor

Great, thanks!

@muttmuure muttmuure changed the title [Performance] Clean up Hoverable component [HIGH] Clean up Hoverable component Nov 29, 2023
Copy link

melvin-bot bot commented Dec 2, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 5, 2023
@melvin-bot melvin-bot bot changed the title [HIGH] Clean up Hoverable component [HOLD for payment 2023-12-12] [HIGH] Clean up Hoverable component Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.7-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 2023-12-12. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

Copy link

melvin-bot bot commented Dec 18, 2023

@cubuspl42, @mountiny, @kacper-mikolajczak Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Dec 18, 2023
@mountiny
Copy link
Contributor Author

@kacper-mikolajczak has been out the PR is moving along though, whats your ETA?

@melvin-bot melvin-bot bot removed the Overdue label Dec 18, 2023
@kacper-mikolajczak
Copy link
Contributor

Hi @mountiny, I am going to complete the PR today and hand it off to the reviewer 👍

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 19, 2023
@mountiny
Copy link
Contributor Author

mountiny commented Jan 9, 2024

@roryabraham Assigning you here too since you have helped a lot with the issue and reviews

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jan 9, 2024
@melvin-bot melvin-bot bot changed the title [HIGH] Clean up Hoverable component [HOLD for payment 2024-01-18] [HIGH] Clean up Hoverable component Jan 11, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 11, 2024
Copy link

melvin-bot bot commented Jan 11, 2024

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

Copy link

melvin-bot bot commented Jan 11, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.24-3 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-01-18. 🎊

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

Copy link

melvin-bot bot commented Jan 11, 2024

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@cubuspl42] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
  • [] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.

Copy link

melvin-bot bot commented Jan 18, 2024

Issue is ready for payment but no BZ is assigned. @MitchExpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

Copy link

melvin-bot bot commented Jan 18, 2024

Payment Summary

Upwork Job

BugZero Checklist (@MitchExpensify)

  • 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

@mountiny
Copy link
Contributor Author

@500 to @cubuspl42 I believe

@MitchExpensify
Copy link
Contributor

Automation didn't seem to create an Upwork offer - Created one here for you @cubuspl42 : https://www.upwork.com/nx/wm/offer/100533857

@cubuspl42
Copy link
Contributor

Accepted 👍

@MitchExpensify
Copy link
Contributor

Paid and contract ended, thanks @cubuspl42

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 NewFeature Something to build that is a new item. Weekly KSv2
Projects
Development

No branches or pull requests

7 participants