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

Remove schedule events duplicate requests and ignore window.resize #4307

Merged
merged 7 commits into from May 20, 2024

Conversation

maskin25
Copy link
Member

@maskin25 maskin25 commented May 3, 2024

What this PR does

Remove schedule events duplicate requests

Which issue(s) this PR closes

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • Added the relevant release notes label (see labels prefixed w/ release:). These labels dictate how your PR will
    show up in the autogenerated release notes.

@maskin25 maskin25 changed the title Remove schedule events duplicate requests Remove schedule events duplicate requests and ignore window.resize May 3, 2024
Comment on lines -483 to -489
useEffect(() => {
window.addEventListener('resize', onResize);
return () => {
window.removeEventListener('resize', onResize);
};
}, []);

Copy link
Collaborator

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? 🤔

Copy link
Member Author

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

Copy link
Member

@teodosii teodosii May 13, 2024

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

Copy link
Member

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.

Comment on lines -65 to -67
useEffect(() => {
refreshEvents(scheduleId);
}, [selectedTimezoneOffset]);
Copy link
Collaborator

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?

Copy link
Member Author

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

@maskin25 maskin25 added pr:no public docs Added to a PR that does not require public documentation updates release:patch PR will be added to "Other Changes" section of release notes labels May 10, 2024
@maskin25 maskin25 marked this pull request as ready for review May 10, 2024 10:06
@maskin25 maskin25 requested a review from a team as a code owner May 10, 2024 10:06
Comment on lines -483 to -489
useEffect(() => {
window.addEventListener('resize', onResize);
return () => {
window.removeEventListener('resize', onResize);
};
}, []);

Copy link
Member

@teodosii teodosii May 13, 2024

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

Comment on lines -483 to -489
useEffect(() => {
window.addEventListener('resize', onResize);
return () => {
window.removeEventListener('resize', onResize);
};
}, []);

Copy link
Member

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.

@teodosii teodosii added this pull request to the merge queue May 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 20, 2024
@teodosii teodosii added this pull request to the merge queue May 20, 2024
Merged via the queue into dev with commit 5544769 May 20, 2024
21 checks passed
@teodosii teodosii deleted the maxim/remove-duplicate-schedule-events-requests branch May 20, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates release:patch PR will be added to "Other Changes" section of release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants