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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: a failing Halloween decoration renders nothing instead of crashing the page; spider takes no clicks when its bar is not found
aashu0358ef3deffc
diff --git a/packages/react/src/Halloween/BarSpider.tsx b/packages/react/src/Halloween/BarSpider.tsxindex fe02429dfa..5ab9be68da 100644--- a/packages/react/src/Halloween/BarSpider.tsx+++ b/packages/react/src/Halloween/BarSpider.tsx@@ -33,6 +33,13 @@ const emptyWeb = (): WebRefs => ({ spokes: null, rings: null, torn: null });// child of the card, the MES's header a child of the page inside it.const BAR_SEARCH_DEPTH = 3;+const EVERYWHERE: Obstacle = {+ left: Number.NEGATIVE_INFINITY,+ top: Number.NEGATIVE_INFINITY,+ right: Number.POSITIVE_INFINITY,+ bottom: Number.POSITIVE_INFINITY+};+/*** The top bar is the element in the layer's card, nearest the card, that* starts where the layer does and is as tall. Everything on it you can see@@ -151,7 +158,9 @@ export function BarSpider({if (!layer) return;s?.layout(layer.getBoundingClientRect());const found = measureBar(layer);- s?.setObstacles(found?.obstacles ?? []);+ // No bar found means nothing known to stay clear of: block the whole+ // layer, or the spider would take clicks meant for whatever is under it.+ s?.setObstacles(found?.obstacles ?? [EVERYWHERE]);if (!found || found.bar === watched) return;barResized.disconnect();barChanged.disconnect();diff --git a/packages/react/src/Halloween/Decorations.tsx b/packages/react/src/Halloween/Decorations.tsxindex 7ce0437254..f0d06414ee 100644--- a/packages/react/src/Halloween/Decorations.tsx+++ b/packages/react/src/Halloween/Decorations.tsx@@ -2,6 +2,7 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.+import { getLogger } from "@carbon/logger";import { AnimatePresence } from "motion/react";import { lazy, Suspense, useCallback, useState } from "react";import { createPortal } from "react-dom";@@ -13,11 +14,15 @@ import { BatFlyby, SuccessBats } from "./Visitors";// The app shell's decorations. Its own chunk, loaded by `HalloweenLayer` only// while the theme is on, so the rest of the year no shell downloads it.+const log = getLogger("react", "halloween");+const loadReveal = () => import("./HalloweenReveal");const HalloweenReveal = lazy(loadReveal);function preloadReveal() {- void loadReveal();+ loadReveal().catch((error) => {+ log.error("Halloween reveal failed to preload", { error });+ });}export default function Decorations() {diff --git a/packages/react/src/Halloween/HalloweenLayer.tsx b/packages/react/src/Halloween/HalloweenLayer.tsxindex 24787cf099..efb546695e 100644--- a/packages/react/src/Halloween/HalloweenLayer.tsx+++ b/packages/react/src/Halloween/HalloweenLayer.tsx@@ -2,9 +2,13 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import { lazy, Suspense, useEffect, useRef, useState } from "react";+import { getLogger } from "@carbon/logger";+import type { ReactNode } from "react";+import { Component, lazy, Suspense, useEffect, useRef, useState } from "react";import { useHalloween } from "./season";+const log = getLogger("react", "halloween");+// Seasonal decoration, shared by the ERP and the MES (`@carbon/react/Halloween`).// Everything renders only on Halloween, when the theme is on for everyone// (`useHalloween`, season.ts); on any other day this returns nothing. The@@ -38,9 +42,11 @@ export function HalloweenLayer() {const on = useHalloween();if (!on) return null;return (- <Suspense fallback={null}>- <Decorations />- </Suspense>+ <Optional>+ <Suspense fallback={null}>+ <Decorations />+ </Suspense>+ </Optional>);}@@ -84,12 +90,34 @@ function LoginArt() {className="pointer-events-none absolute inset-0 overflow-hidden">{shown && (- <Suspense fallback={null}>- <NightShift />- </Suspense>+ <Optional>+ <Suspense fallback={null}>+ <NightShift />+ </Suspense>+ </Optional>)}{/* Keeps the panel's headline readable over the fog. */}<div className="absolute inset-x-0 bottom-0 z-10 h-64 bg-gradient-to-t from-black/75 via-black/40 to-transparent" /></div>);}++/**+ * Renders nothing once a decoration throws or its chunk fails to load, so a+ * broken decoration never takes the app shell or the sign-in page down.+ */+class Optional extends Component<{ children: ReactNode }, { failed: boolean }> {+ state = { failed: false };++ static getDerivedStateFromError() {+ return { failed: true };+ }++ componentDidCatch(error: unknown) {+ log.error("Halloween decoration failed", { error });+ }++ render() {+ return this.state.failed ? null : this.props.children;+ }+}diff --git a/packages/react/src/Halloween/night-shift/NightShift.tsx b/packages/react/src/Halloween/night-shift/NightShift.tsxindex 3724234612..577109bab4 100644--- a/packages/react/src/Halloween/night-shift/NightShift.tsx+++ b/packages/react/src/Halloween/night-shift/NightShift.tsx@@ -202,13 +202,16 @@ export default function NightShift() {const tick = (now: number) => {if (disposed) return;- frameId = window.requestAnimationFrame(tick);const delta = now - last;- if (delta < 1000 / FPS - 2) return;- last = now;- // A hidden tab gets no frames; pick the story up where it was.- clock += Math.min(delta, 250) / 1000;- draw();+ if (delta >= 1000 / FPS - 2) {+ last = now;+ // A hidden tab gets no frames; pick the story up where it was.+ clock += Math.min(delta, 250) / 1000;+ draw();+ }+ // Asked for after the draw: a frame that throws ends the loop instead+ // of throwing again on every frame.+ frameId = window.requestAnimationFrame(tick);};const redraw = () => {