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

Removed render modifiers from Daily/Weekly calendar #8326

Merged

Conversation

michaelchadwick
Copy link
Contributor

@michaelchadwick michaelchadwick commented Jan 23, 2025

Refs ilios/ilios#5374

Couldn't figure any other way out, so I basically re-created {{did-update}} as a custom modifier called on-update. All it does it take in an event to listen for, and run a callback with an argument. This meant changing the scroll mechanism from a task-like call to a simple @action.

No idea if this is the way we want to approach stuff like this, but it's a start!

@michaelchadwick michaelchadwick marked this pull request as ready for review January 24, 2025 00:56
@michaelchadwick
Copy link
Contributor Author

NTS: Try to use the existing scroll-into-view modifier instead.

@michaelchadwick
Copy link
Contributor Author

OK, simplified the whole thing and changed to an in-component modifier at the behest of @stopfstedt's suggestion. Thanks to @jrjohnson for the example he recently did in ember-simple-charts!

Copy link
Member

@stopfstedt stopfstedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, overall just a few minor changes and this should be good to go.


if (earliestHour < 24 && earliestHour > 2) {
hourElement = this[`hour${earliestHour}`];
hourElement = document.getElementsByClassName(`hour-${earliestHour}`)[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hourElement = document.getElementsByClassName(`hour-${earliestHour}`)[0];
hourElement = element.getElementsByClassName(`hour-${earliestHour}`)[0];

let hourElement = this.hour6;
scrollView = modifier((element, [earliestHour]) => {
// all of the hour elements are registered in the template as hour-0, hour-1, etc
let hourElement = document.getElementsByClassName(`hour-6`)[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let hourElement = document.getElementsByClassName(`hour-6`)[0];
let hourElement = element.getElementsByClassName(`hour-6`)[0];


if (earliestHour < 24 && earliestHour > 2) {
hourElement = this[`hour${earliestHour}`];
hourElement = document.getElementsByClassName(`hour-${earliestHour}`)[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hourElement = document.getElementsByClassName(`hour-${earliestHour}`)[0];
hourElement = element.getElementsByClassName(`hour-${earliestHour}`)[0];

let hourElement = this.hour6;
scrollView = modifier((element, [earliestHour]) => {
// all of the hour elements are registered in the template as hour-0, hour-1, etc
let hourElement = document.getElementsByClassName(`hour-6`)[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggesting to anchor this query to the passed-in container element instead of the document root note.
scoping this down reduces churn and prevents potential class-name collisions.

Suggested change
let hourElement = document.getElementsByClassName(`hour-6`)[0];
let hourElement = element.getElementsByClassName(`hour-6`)[0];

@stopfstedt stopfstedt self-requested a review January 28, 2025 00:06
Copy link
Member

@stopfstedt stopfstedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stopfstedt stopfstedt added the run ui tests Run the expensive UI tests label Jan 28, 2025
@dartajax dartajax merged commit 5e3edef into ilios:master Jan 28, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run ui tests Run the expensive UI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants