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

ScrollTop and ScrollLeft state should be componentStates to avoid side effects #4826

Open
charlesBochet opened this issue Apr 4, 2024 · 5 comments
Assignees
Labels
good first issue Good for newcomers ready scope: front Issues that are affecting the frontend side only size: minutes type: chore

Comments

@charlesBochet
Copy link
Member

Scope & Context

While refactoring ScrollWrapper component, we have recently introduced two states: ScrollTop and ScrollLeft. These states should be componentState so each ScrollWrapper instance does have its own state. Otherwise they are all interacting together, creating re-renders

How:

In scrollLeftState (same for scrollTopState)

  • Rename it to scrollLeftComponentState, and use createComponentState instead of createState
  • introduce useScrollStates hook that will only extractComponentState and take a scrollWrapperId as a parameter. See useViewStates for an example.
  • replace direct import of scrollLeftState by call to useScrollStates
@charlesBochet charlesBochet added type: chore good first issue Good for newcomers scope: front Issues that are affecting the frontend side only size: minutes ready labels Apr 4, 2024
@Jeetch8
Copy link
Contributor

Jeetch8 commented Apr 11, 2024

I want to take on this issue. Can you please assign it to me ?

@charlesBochet
Copy link
Member Author

Sure! Thank you @Jeetch8

@Jeetch8
Copy link
Contributor

Jeetch8 commented Apr 12, 2024

I have created the PR. Please check #4938

@charlesBochet
Copy link
Member Author

Thank you, taking a look!

@FelixMalfait
Copy link
Member

Screenshot 2024-05-17 at 09 19 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers ready scope: front Issues that are affecting the frontend side only size: minutes type: chore
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants