fix(Gridler): update ready state management logic

This commit is contained in:
Hein
2026-02-11 14:29:24 +02:00
parent 3887d08fca
commit 28ccd8af56

View File

@@ -7,7 +7,7 @@ import {
} from '@glideapps/glide-data-grid';
import { Group, Stack } from '@mantine/core';
import { useElementSize, useMergedRef } from '@mantine/hooks';
import React from 'react';
import React, { useEffect } from 'react';
import { BottomBar } from './components/BottomBar';
import { Computer } from './components/Computer';
@@ -107,14 +107,22 @@ export const GridlerDataGrid = () => {
setStateFN('_glideref', () => {
return r ?? undefined;
});
const ready = getState('ready');
const newReady = !!(r && mounted);
if (ready !== newReady) {
setState('ready', newReady);
}
});
useEffect(() => {
if (ref.current && mounted) {
const currentReady = getState('ready');
if (!currentReady) {
setState('ready', true);
}
} else {
const currentReady = getState('ready');
if (currentReady) {
setState('ready', false);
}
}
}, [mounted, getState, setState]);
const theme = useGridTheme();
return (