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

Should refactor out listening for window resize on componentDidMount #993

Open
euanmillar opened this issue Aug 5, 2019 · 3 comments
Open
Assignees
Labels
👍 Beginner friendly This task is suitable for someone starting out OpenCRVS development 🧹Chore Tech
Milestone

Comments

@euanmillar
Copy link
Collaborator

euanmillar commented Aug 5, 2019

All of these calls in componentDidMount:

window.addEventListener('resize', this.recordWindowWidth)

Should be replaced with: https://github.com/streamich/react-use/blob/master/docs/useWindowSize.md

@euanmillar euanmillar added the Tech label Aug 5, 2019
@euanmillar euanmillar added Priority: low Doesn't have a considerable negative impact on the codebase at the moment and removed Tech labels Jun 24, 2020
@euanmillar
Copy link
Collaborator Author

Could look at all the components that have this handler and scope out refactoring them to use react hooks.

@jpye-finch jpye-finch moved this to Backlog in OpenCRVS Core Nov 22, 2023
@rikukissa rikukissa added 👍 Beginner friendly This task is suitable for someone starting out OpenCRVS development 🧹Chore and removed Priority: low Doesn't have a considerable negative impact on the codebase at the moment labels Jun 12, 2024
@Zangetsu101
Copy link
Collaborator

Instead of adding the dependency, we can directly use this one: https://github.com/opencrvs/opencrvs-core/blob/develop/packages/components/src/hooks/useWindowSize.ts

@noah-brunate
Copy link
Collaborator

So in this case it means I will be converting all the class components which use "window.addEventListener('resize', this.recordWindowWidth)" in the method "componentDidMount" into functional components.

@Zangetsu101 Zangetsu101 moved this from Backlog to In Code Review in OpenCRVS Core Sep 24, 2024
@noah-brunate noah-brunate self-assigned this Oct 18, 2024
@euanmillar euanmillar added this to the v1.7.0 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 Beginner friendly This task is suitable for someone starting out OpenCRVS development 🧹Chore Tech
Projects
Status: In Code Review
Development

No branches or pull requests

5 participants