Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: the Halloween spider stays asleep after its web snaps instead of running frames while the pointer moves

aashu6b10f49b5d21
diff --git a/packages/react/src/Halloween/bar-spider.test.ts b/packages/react/src/Halloween/bar-spider.test.ts
index 05e726faf1..05c6231a82 100644
--- a/packages/react/src/Halloween/bar-spider.test.ts
+++ b/packages/react/src/Halloween/bar-spider.test.ts
@@ -334,6 +334,20 @@ describe("createBarSpider", { timeout: 30_000 }, () => {
expect(slept).toBe(true);
});
+ it("stays asleep after the snap while the pointer sweeps the broken webs", () => {
+ const { sim } = setup();
+ sim.appear();
+ live(5);
+ sim.snap();
+ live(1);
+ sim.sleep();
+ for (const hub of sim.state().hubs) {
+ for (let dx = -60; dx <= 60; dx += 6) moveTo(hub.x + dx, hub.y);
+ }
+ live(5);
+ expect(frames.size).toBe(0);
+ });
+
it("with reduced motion it simply stays in its web", () => {
const { sim } = setup({ reducedMotion: true });
sim.appear();
diff --git a/packages/react/src/Halloween/bar-spider.ts b/packages/react/src/Halloween/bar-spider.ts
index 17fa5ef6fc..0b54dadd07 100644
--- a/packages/react/src/Halloween/bar-spider.ts
+++ b/packages/react/src/Halloween/bar-spider.ts
@@ -684,7 +684,9 @@ export function createBarSpider() {
pointer.x = p.x;
pointer.y = p.y;
pointer.time = now;
- if (options.reducedMotion) return;
+ // A fallen spider never counts as resting, so a wake here would run
+ // frames until `appear`.
+ if (options.reducedMotion || spider.mode === "fall") return;
const near = Math.hypot(p.x - spider.body.x, p.y - spider.body.y);
const wasNear = pointerWasNear;