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
Remove schedule events duplicate requests and ignore window.resize #4307
Remove schedule events duplicate requests and ignore window.resize #4307
Conversation
useEffect(() => { | ||
window.addEventListener('resize', onResize); | ||
return () => { | ||
window.removeEventListener('resize', onResize); | ||
}; | ||
}, []); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was there maybe a valid reason why we called onHide
on window resize? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen.Recording.2024-05-10.at.11.09.30.mov
I found the only case when window resizng can be an issue (see video attached), in that case user can just resize window back, it's better than just close the modal on any resize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should add some calculations if we remove the resize handler. When that happens it's not very clear for the user that the resize triggered that behavior, and we will run into escalations again. Either we
- close the modal on resizing (no one on prod environment is expected really to open the devtools)
- OR figure out boundaries for the modal on each
resize
event, and eventually, if it doesn't fit, you'll still need to close it, so it's basically the first option with 1 extra step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way I think some implementation needs to be added when the browser is being narrowed, otherwise users will run into scenario where they cannot close/submit the modal anymore due to vertical/horizontal restrains.
useEffect(() => { | ||
refreshEvents(scheduleId); | ||
}, [selectedTimezoneOffset]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this was refetching events if you changed the timezone dropdown and this will no longer be the case? Is there any negative consequences of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since your comment I've added refreshing schedules events on TimezoneSelect onChange callback, it settles things
useEffect(() => { | ||
window.addEventListener('resize', onResize); | ||
return () => { | ||
window.removeEventListener('resize', onResize); | ||
}; | ||
}, []); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should add some calculations if we remove the resize handler. When that happens it's not very clear for the user that the resize triggered that behavior, and we will run into escalations again. Either we
- close the modal on resizing (no one on prod environment is expected really to open the devtools)
- OR figure out boundaries for the modal on each
resize
event, and eventually, if it doesn't fit, you'll still need to close it, so it's basically the first option with 1 extra step
useEffect(() => { | ||
window.addEventListener('resize', onResize); | ||
return () => { | ||
window.removeEventListener('resize', onResize); | ||
}; | ||
}, []); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way I think some implementation needs to be added when the browser is being narrowed, otherwise users will run into scenario where they cannot close/submit the modal anymore due to vertical/horizontal restrains.
What this PR does
Remove schedule events duplicate requests
Which issue(s) this PR closes
Checklist
pr:no public docs
PR label added if not required)release:
). These labels dictate how your PR willshow up in the autogenerated release notes.