fix(Gridler): update ready state management logic
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user