fix: position page below AppShell header, wait for container size

- Page uses top-16/sm:top-14 to start below AppShell header (z-50)
  instead of inset-0 which renders behind the header
- Sigma init polls with RAF until container has real dimensions
  instead of allowInvalidContainer which creates broken canvas
- Removed overflow-hidden from content area (not needed)
This commit is contained in:
Fringg
2026-03-19 09:04:55 +03:00
parent 6f58a0ce5d
commit fd9a47ecda
2 changed files with 18 additions and 11 deletions

View File

@@ -129,11 +129,16 @@ export function NetworkGraph({ data, className }: NetworkGraphProps) {
if (!containerRef.current || !data) return;
const container = containerRef.current;
let rafId: number;
let cancelled = false;
// Defer initialization to next frame so the browser computes layout first.
// Without this, container.offsetHeight is 0 and Sigma throws.
const rafId = requestAnimationFrame(() => {
if (!container.isConnected) return;
// Poll until container has real dimensions (browser needs a frame to compute layout)
function tryInit() {
if (cancelled || !container.isConnected) return;
if (container.offsetWidth === 0 || container.offsetHeight === 0) {
rafId = requestAnimationFrame(tryInit);
return;
}
// Cleanup previous instance
killFA2();
@@ -150,7 +155,6 @@ export function NetworkGraph({ data, className }: NetworkGraphProps) {
hiddenNodesRef.current = computeHiddenNodes(graph, initialFilters);
const sigma = new Sigma(graph, container, {
allowInvalidContainer: true,
renderEdgeLabels: false,
labelDensity: 0.5,
labelRenderedSizeThreshold: 6,
@@ -297,9 +301,12 @@ export function NetworkGraph({ data, className }: NetworkGraphProps) {
containerRef.current.style.cursor = 'default';
}
});
}); // end requestAnimationFrame
}
rafId = requestAnimationFrame(tryInit);
return () => {
cancelled = true;
cancelAnimationFrame(rafId);
killFA2();
if (sigmaRef.current) {