fix(flow-canvas): MIN_HOST is a fallback, not a floor (#669 live overlap) (#673)

* fix(sovereign-console): use DerivedJob.title not displayName/jobName (#669 follow-up)

Build-ui failed in CI on `tsc -b` (which `tsc --noEmit` doesn't catch
locally without strict project-references). DerivedJob from
src/pages/sovereign/jobs.ts uses `title`, not the flat-Job
`displayName`/`jobName` fields. Use `dj.title || dj.id` for the
global-log component-name prefix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(flow-canvas): MIN_HOST is a fallback, not a floor (#669 follow-up)

Live test on console.openova.io after PR #671 showed bubbles overlapping
by ~13 CSS px. Root cause: ResizeObserver clamped hostSize.w to
max(MIN_HOST_W=1200, contentRect.w=686). The SVG then rendered 1200
viewBox-units into 686 CSS px (0.57× downscale), shrinking bubble
diameters AND collapsing pairwise distances below the
NODE_RADIUS*2 + COLLIDE_PADDING (= 92 px) threshold.

Use the actual contentRect dimensions; only fall back to MIN_HOST
when the rect is 0×0 (degenerate first-paint). Now viewBox = host px
1:1 → bubble radius is exactly NODE_RADIUS CSS px and forceCollide's
pairwise spacing guarantee holds in screen space.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: hatiyildiz <hatice@openova.io>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
e3mrah 2026-05-03 15:25:02 +04:00 committed by GitHub
parent cc52ab875b
commit 2e0c374eab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -239,8 +239,15 @@ export function FlowCanvasOrganic(props: FlowCanvasOrganicProps) {
const e = entries[0]
if (!e) return
const rect = e.contentRect
const w = Math.max(MIN_HOST_W, Math.round(rect.width))
const h = Math.max(MIN_HOST_H, Math.round(rect.height))
// Use the actual measured rect — not a floor. The MIN_HOST_*
// constants only apply when the rect is degenerate (0×0 during
// first paint). Forcing the viewBox to MIN_HOST_W when the
// host is narrower (e.g. LogPane reserves 30vw) causes the
// SVG to render 1200 viewBox-units into 686 CSS px (0.57×
// downscale), shrinking bubbles AND collapsing pairwise
// distances below the no-overlap threshold.
const w = Math.round(rect.width) || MIN_HOST_W
const h = Math.round(rect.height) || MIN_HOST_H
cancelAnimationFrame(raf)
raf = requestAnimationFrame(() => {
setHostSize((prev) => (prev.w === w && prev.h === h ? prev : { w, h }))