1
0
Fork 0

Added Statistics calculation

Statistics now show calculated values
This commit is contained in:
Techognito 2025-09-04 17:30:00 +02:00
parent fe87374e47
commit fc0f69dacb
2147 changed files with 141321 additions and 39 deletions

View file

@ -0,0 +1,36 @@
import * as React from 'react';
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
const isDevEnvironment = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
const noop = () => {};
export function useResizeObserver(ref, fn, enabled) {
const fnRef = React.useRef(null);
fnRef.current = fn;
useEnhancedEffect(() => {
if (enabled === false || typeof ResizeObserver === 'undefined') {
return noop;
}
let frameID = 0;
const target = ref.current;
const observer = new ResizeObserver(entries => {
// See https://github.com/mui/mui-x/issues/8733
// In dev, we avoid the React warning by moving the task to the next frame.
// In prod, we want the task to run in the same frame as to avoid tear.
if (isDevEnvironment) {
frameID = requestAnimationFrame(() => {
fnRef.current(entries);
});
} else {
fnRef.current(entries);
}
});
if (target) {
observer.observe(target);
}
return () => {
if (frameID) {
cancelAnimationFrame(frameID);
}
observer.disconnect();
};
}, [ref, enabled]);
}