diff --git a/gui/src/hooks/useRenderDebug.tsx b/gui/src/hooks/useRenderDebug.tsx index 6aa3e936c..bc5fb8308 100644 --- a/gui/src/hooks/useRenderDebug.tsx +++ b/gui/src/hooks/useRenderDebug.tsx @@ -7,13 +7,13 @@ import { CSSProperties, useEffect, useRef } from "react"; * * - Returns a `ref` to attach to a container element and a `count` that * increments on every render of the component using this hook. - * - On each render, it briefly adds a CSS class (default: `toolbar-rerender-flash`) + * - On each render, it briefly adds a CSS class (default: `rerender-flash`) * to the element for a quick visual flash. * - Use together with to show the render count inline. * * Options: * - enabled: boolean to toggle the effect (default true) - * - flashClassName: class added on each render (default `toolbar-rerender-flash`) + * - flashClassName: class added on each render (default `rerender-flash`) * - flashDurationMs: duration of the flash animation in ms (default 180) */ @@ -24,7 +24,7 @@ export function useRenderDebug(options?: { }) { const { enabled = true, - flashClassName = "toolbar-rerender-flash", + flashClassName = "rerender-flash", flashDurationMs = 180, } = options || {}; @@ -56,7 +56,7 @@ export function RenderCountBadge(props: { const { count, title = `Renders: ${count}`, style, className } = props; return ( diff --git a/gui/src/index.css b/gui/src/index.css index 6ef5e902e..fce97497e 100644 --- a/gui/src/index.css +++ b/gui/src/index.css @@ -119,3 +119,28 @@ body { .scroll-container:is(:hover, :focus)::-webkit-scrollbar { display: block; /* Show scrollbar only on hover or focus */ } + +/* Debug: visible flash when component re-renders */ +@keyframes rerenderFlash { + 0% { + box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.9) inset; + } + 100% { + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0) inset; + } +} + +.rerender-flash { + animation: rerenderFlash 180ms ease-out; +} + +.render-count { + display: inline-block; + margin-right: 6px; + padding: 0 4px; + border-radius: 3px; + background: rgba(255, 0, 0, 0.15); + color: rgba(255, 0, 0, 0.9); + font-weight: 600; + letter-spacing: 0.02em; +}