[bug] Resource Scheduler: LazyLoader calls IntersectionObserver.observe(null) when detached before effects flush, stalling later calendars#1384
Minimal reproduction environment
No framework needed:
import { createCalendar } from "@schedule-x/calendar";
import { createConfig, createDailyView, createHourlyView } from "@sx-premium/resource-scheduler";
function mount(date) {
const host = document.createElement("div");
host.style.cssText = "width:1000px;height:600px";
document.body.appendChild(host);
const cfg = createConfig();
const cal = createCalendar({
views: [createDailyView(cfg), createHourlyView(cfg)],
selectedDate: Temporal.PlainDate.from(date),
resources: [{ id: "a", label: "A" }],
events: [],
});
cal.render(host);
return { host, cal };
}
const first = mount("2026-10-04");
const mo = new MutationObserver(() => {
if (!first.host.querySelector(".sx__resource-view__lazy-loader")) return;
mo.disconnect();
first.host.remove(); // detached before effects flush, as a React remount does
first.cal.destroy();
const second = mount("2026-10-11");
setTimeout(() => console.log(second.host.querySelectorAll(".sx__resource-view__lazy-loader").length), 500);
});
mo.observe(first.host, { childList: true, subtree: true });
Versions: @sx-premium/resource-scheduler 16.0.1 and 16.0.2, @schedule-x/calendar 4.8.1, preact 10.28.3. Browsers: Chrome 153, Safari 27.
Describe the bug
LazyLoader calls observer.observe(document.getElementById(targetId)) in an empty-deps . If the calendar's DOM is detached before preact flushes after-paint effects, returns and throws: