Skip to content

Calendar fixes: slow regexes, an event that won't open, and a resize error - #2089

Merged
jm1021 merged 6 commits into
Open-Coding-Society:mainfrom
svaka2000:fix/calendar-fixes
Nov 26, 2026
Merged

jm1021 merged 6 commits into
Open-Coding-Society:mainfrom
svaka2000:fix/calendar-fixes

Conversation

@svaka2000

Copy link
Copy Markdown
Contributor

This puts my three calendar PRs, #2079, #2083 and #2087, into one, since I had a lot of PRs open. They all change the calendar code, and #2083 was already stacked on #2079. I merged each branch in with git merge --no-ff instead of squashing, so the commits are the same ones those PRs had and each PR has its own merge commit. It doesn't need any other PR or a Spring change.

From #2079: the ticker and the calendar page stay fast on text full of <

  • The ticker (the Coming up bar on course homes) takes the tags out of an event title that has HTML in it, with the regex in the constant TAG in calendar-ticker.js. slackToHtml on the calendar page (_projects/systems/calendar/index.md) turns <url|text> in a description into links.
  • Both regexes read from where a match could start to the next >. With no > after it, they read to the end again from every such place: every < for TAG, and every <http: for the link regex. Now a match also stops at the next <.
  • Normal events look the same. Keep the ticker and the calendar page fast on titles and descriptions full of "<" #2079 compared 500,000 random titles and 500,000 random descriptions, and only two cases changed.
  • x < y <b>bold</b> shows as x < y bold in the ticker (main showed x bold), and <https://a.b|x < y> isn't made a link. Slack writes that < as &lt;, so links from Slack don't change.
  • This matters because Spring's title and description columns are varchar(255), SQLite doesn't enforce that, and Spring's README says production is on SQLite right now.
  • In WebKit (Safari's engine), opening a faked event whose description is 30,000 <http:a links that never close took 5.4 s on main and 0.2 s on this branch, in one run today. In Chrome it took 2.0 s and 0.1 s.

From #2083: a description that says %%LK0%% doesn't stop its event from opening

  • While slackToHtml formats a description, it replaces code and links with numbered placeholders (%%CB0%%, %%IC0%%, %%LK0%%), then puts them back. Any signed-in account can write a description, so it can have that text in it too.
  • A description that said %%LK0%% with no link made slackToHtml throw, so the event's window never opened, and Edit and Delete are only in that window.
  • A typed %%CB0%% or %%IC0%% turned into empty code. So did IC1 between two links, like <https://a.b|x>IC1<https://c.d|y>, because the links' placeholders put %% on both sides of it, and then neither link showed.
  • Now a placeholder with nothing saved under its number stays as typed.

On main, clicking the Room change event, whose description is Room %%LK0%% today, opens no window

On this branch, the Room change event's window opens with the description Room %%LK0%% today

From #2087: resizing the week calendar or the Coming up bar doesn't fire a ResizeObserver error

  • The week calendar switches to a row per day when it's under 640px wide, and the Coming up bar starts sliding when its events don't fit on one line. Both watch their own width with a ResizeObserver, a browser API that calls a function when an element's size changes.
  • Both switched layouts inside that function, which changed the watched element's size while the browser was still reporting sizes, so it could fire the error "ResizeObserver loop completed with undelivered notifications". Not every resize did. WebKit reports it as an uncaught error. The layouts still ended up right.
  • Now the new WidthWatcher (width-watcher.js) redraws on the next animation frame instead, so the old layout shows for one frame (about 16 ms on a 60 Hz screen).

Other notes:

How to try it:

  1. Check out fix/calendar-fixes from svaka2000/Pages-JJ.
  2. Run node --test tests/calendar_ticker.test.mjs tests/calendar_slack_text.test.mjs tests/calendar_doc_links.test.mjs tests/calendar_safe_html.test.mjs tests/width_watcher.test.mjs tests/week_row_tools.test.mjs. It passes in under a second.

…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.
… fast on text full of "<"

Branch fix/calendar-tag-link-regex, head a22e0d5.
…from stopping its event from opening

Branch fix/calendar-slack-placeholders, head 0fa22e1.
…bar from firing a ResizeObserver error

Branch fix/week-view-resize-frame, head 07d5610.
@jm1021

jm1021 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Events

Events are a big feature for OCS. An Event Management System that nonprofits, incubator companies, and classrooms can reuse.

  • Someone creates an opportunity for people to participate.
  • Someone publishes information and supporting materials.
  • People discover the opportunity and respond.
  • People communicate before the event.
  • Someone organizes and delivers the event.
  • The community captures the outcomes afterward.

An Event is a central object

The Event is the parent object that connects all the other capabilities.
image

The Event lifecycle

The pre-event and post-event ideas into three distinct phases.

01

PRE-EVENT — Discover and prepare

  • Event announcement and promotional content
  • Registration / RSVP
  • Participant questions
  • Event agenda and schedule
  • Speaker, presenter, or instructor information
  • Location, directions, and resources
  • Reminders and notifications

02

DURING EVENT — Organize and deliver

  • Organizer dashboard
  • Attendance check-in
  • Live agenda and schedule
  • Presentation materials
  • Live updates and announcements
  • Chat and participant interaction
  • QR code for event check-in

03

POST-EVENT — Capture and reflect

  • Actual attendance
  • Photo and video galleries
  • Presentations and documents
  • Outcomes and accomplishments
  • Participant feedback and surveys
  • Retrospective
  • Follow-up activities

Create an event (Card and Page)

Enter a title, description, date, time, location, and category.

  • Upload a flyer, Word document, PDF, or presentation.
  • Add images or a gallery.
  • Select an event presentation template.
  • Preview the resulting event.
  • Publish. Works with your notification system
---
layout: event
title: "Community Technology Workshop"
description: "An introduction to practical AI."
date: 2027-03-15
start_time: "10:00"
end_time: "13:00"

categories:
  - Community
  - Technology
  - Workshop

event_type: workshop
status: published

location:
  name: "Community Center"
  address: "Poway, California"

organizer:
  name: "Open Coding Society"

registration:
  enabled: true
  capacity: 50

attachments:
  - type: gallery
    id: workshop-gallery

  - type: document
    id: workshop-agenda

features:
  microblog: true
  registration: true
  attendance: true
  gallery: true
---
image image

@jm1021

jm1021 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor
Component Responsibility
Jekyll Event catalogs, categories, static pages, SEO Search Engine Optimization
Event Builder Authoring, editing, previewing, publishing
Event Service (Flask) Event CRUD, lifecycle, APIs
Database Events, users, RSVPs, attendance, comments
AWS S3 Attachments, galleries, generated derivatives
OCS Chat Event communication
OCS Microblog Persistent event discussion
UI Builder Event presentation and component configuration
Notification Service Reminders, confirmations, updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants