-
Notifications
You must be signed in to change notification settings - Fork 261
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
Changes from 4 commits
b73ead2
05fa76e
9a3024a
3ded316
030d9fc
3511a09
69ad632
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React, { FC, useEffect } from 'react'; | ||
import React, { FC } from 'react'; | ||
|
||
import { HorizontalGroup } from '@grafana/ui'; | ||
import cn from 'classnames/bind'; | ||
|
@@ -40,8 +40,7 @@ interface ScheduleFinalProps extends WithStoreProps { | |
const _ScheduleFinal: FC<ScheduleFinalProps> = observer( | ||
({ store, simplified, scheduleId, filters, onShowShiftSwapForm, onShowOverrideForm, onSlotClick }) => { | ||
const { | ||
timezoneStore: { currentDateInSelectedTimezone, calendarStartDate, selectedTimezoneOffset }, | ||
scheduleStore: { refreshEvents }, | ||
timezoneStore: { currentDateInSelectedTimezone, calendarStartDate }, | ||
} = store; | ||
const base = 7 * 24 * 60; // in minutes | ||
const diff = currentDateInSelectedTimezone.diff(calendarStartDate, 'minutes'); | ||
|
@@ -62,10 +61,6 @@ const _ScheduleFinal: FC<ScheduleFinalProps> = observer( | |
onShowOverrideForm('new', shiftStart, shiftEnd); | ||
}; | ||
|
||
useEffect(() => { | ||
refreshEvents(scheduleId); | ||
}, [selectedTimezoneOffset]); | ||
|
||
Comment on lines
-65
to
-67
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 |
||
return ( | ||
<div className={cx('root')}> | ||
{!simplified && ( | ||
|
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
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 stepThere 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.