Skip to content

Narrow PR scope to observer tick error isolation; restore synchronous initial render - #371

Draft
mattcosta7 with Copilot wants to merge 2 commits into
copilot/optimize-relative-time-updatefrom
copilot/copilotoptimize-relative-time-update-again
Draft

Narrow PR scope to observer tick error isolation; restore synchronous initial render#371
mattcosta7 with Copilot wants to merge 2 commits into
copilot/optimize-relative-time-updatefrom
copilot/copilotoptimize-relative-time-update-again

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This revision removes the previously introduced connectedCallback microtask batching and keeps only the high-value safety fix: a single element error should not abort a dateObserver tick for all observed elements. It also drops per-tick locale/time-zone/hour-cycle caching from this branch to avoid correctness risk and overlap with existing global Intl caching.

  • Scope reset: restore main lifecycle semantics

    • Removed module-level pending render queue (pendingElements, pendingFlush, flushPending).
    • Restored synchronous connectedCallback() render (this.update()).
    • Restored disconnectedCallback() and attributeChangedCallback() behavior to match main (no pending-queue coupling).
  • Observer robustness: per-element error isolation

    • Guarded each timeEl.update() inside dateObserver.update() so one throw does not stop remaining elements or prevent rescheduling.
    • Preserved global error visibility by rethrowing asynchronously.
  • Tests updated to lock intended behavior

    • Removed the full connectedCallback microtask batching suite.
    • Added synchronous-render contract coverage (text/title present immediately after append).
    • Added error-isolation coverage demonstrating other elements continue updating and observer scheduling continues when one element throws.
for (const timeEl of this.elements) {
  nearestDistance = Math.min(nearestDistance, getUnitFactor(timeEl))
  try {
    timeEl.update()
  } catch (error) {
    setTimeout(() => {
      throw error
    })
  }
}

Copilot AI changed the title [WIP] Remove memoization cache from relative time update Narrow PR scope to observer tick error isolation; restore synchronous initial render Jul 30, 2026
Copilot AI requested a review from mattcosta7 July 30, 2026 16:16
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