Repository navigation
Conversation
…em reports no error The course home's week calendar redrew its table inside its ResizeObserver callback when its width crossed 640px, and the Coming up ticker started or stopped moving inside its own callback. Both changed the size of the element being watched while the observer was still reporting. When nothing else the page watches changed size in that frame, the browser fired "ResizeObserver loop completed with undelivered notifications": WebKit (Safari's engine) reports it as an uncaught error, and Chrome fires it at the page without logging it. A page that hides the week view and shows it again got the same error. WidthWatcher (js/announcement-calendar/width-watcher.js) keeps the width check in the callback and runs the redraw on the next animation frame, once. mountWeekView and CalendarTicker use it, and both cancel a redraw that hasn't run when they're unmounted.
Contributor
Author
|
Combined into #2089 with the same commits. |
jm1021
pushed a commit
that referenced
this pull request
Nov 26, 2026
…esizeObserver error Branch fix/week-view-resize-frame, head 07d5610.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two parts of a course home watch their own width with a ResizeObserver, a browser API that calls a function when an element's size changes:
mountWeekViewin_projects/systems/courses/js/announcement-calendar/calendar-feed.js) switches to a narrow table, with a row per day, when it's under 640px wide.CalendarTickerincalendar-ticker.js, same folder) starts sliding when its announcements don't fit on one line, and stops when they do. It only shows for signed-in visitors, since it reads Spring's calendar.What changed:
windowerrorlistener gets it). Apart from the error, both parts still ended up in the right layout.WidthWatcher(new, inwidth-watcher.js) compares the width in the observer's function. When it changed, it asksrequestAnimationFramefor one redraw on the next frame, which reads the latest width. Both parts use it, andstop(), which their unmount calls, cancels a redraw that hasn't run.Other notes:
/navigation/courses/csa/) in WebKit and in Chrome, with the Spring backend faked, once with main's code and once with this branch's._projects/systems/courses/tests/width_watcher.test.mjs(tests/width_watcher.test.mjsruns it) check that a new width is redrawn on the next frame and not inside the observer's function, that an observer call with the same width does nothing, and thatstop()drops a redraw that hasn't run. The ticker's resize test now checks for the next frame too.AGENTS.md,AGENTS_MD_DOCUMENTATION.mdand the Courses README.How to try it:
fix/week-view-resize-framefromsvaka2000/Pages-JJ.node --test tests/width_watcher.test.mjs tests/calendar_ticker.test.mjs tests/week_row_tools.test.mjs.