mirror of https://github.com/buster-so/buster.git
Merge pull request #514 from buster-so/staging
Staging to main hot fixes
This commit is contained in:
commit
a690e1aa81
|
@ -47,8 +47,13 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
|
||||||
const dataContainerClassName = !topHidden ? `pt-${gapAmount}` : '';
|
const dataContainerClassName = !topHidden ? `pt-${gapAmount}` : '';
|
||||||
|
|
||||||
const bustStorageOnInit = useMemoizedFn(
|
const bustStorageOnInit = useMemoizedFn(
|
||||||
(preservedSideValue: number | null, refWidth: number) => {
|
(preservedSideValue: number | null, refSize: number) => {
|
||||||
return !preservedSideValue || preservedSideValue < 80 || refWidth < 120;
|
return (
|
||||||
|
!preservedSideValue ||
|
||||||
|
preservedSideValue < 80 ||
|
||||||
|
refSize < 120 ||
|
||||||
|
preservedSideValue > refSize - 80
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ interface IAppSplitterProps {
|
||||||
* Whether to clear saved layout from localStorage on initialization
|
* Whether to clear saved layout from localStorage on initialization
|
||||||
* Can be a boolean or a function that returns a boolean based on preserved side value and container width
|
* Can be a boolean or a function that returns a boolean based on preserved side value and container width
|
||||||
*/
|
*/
|
||||||
bustStorageOnInit?: boolean | ((preservedSideValue: number | null, refWidth: number) => boolean);
|
bustStorageOnInit?: boolean | ((preservedSideValue: number | null, refSize: number) => boolean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to render the left panel content
|
* Whether to render the left panel content
|
||||||
|
@ -302,15 +302,18 @@ const AppSplitterBase = forwardRef<
|
||||||
// ================================
|
// ================================
|
||||||
|
|
||||||
const bustStorageOnInitSplitter = (preservedSideValue: number | null) => {
|
const bustStorageOnInitSplitter = (preservedSideValue: number | null) => {
|
||||||
const refWidth = containerRef.current?.offsetWidth;
|
const refSize =
|
||||||
|
split === 'vertical'
|
||||||
|
? containerRef.current?.offsetWidth
|
||||||
|
: containerRef.current?.offsetHeight;
|
||||||
// Don't bust storage if container hasn't been sized yet
|
// Don't bust storage if container hasn't been sized yet
|
||||||
if (!refWidth || refWidth === 0) {
|
if (!refSize || refSize === 0) {
|
||||||
// console.warn('AppSplitter: container not sized yet');
|
// console.warn('AppSplitter: container not sized yet');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeof bustStorageOnInit === 'function'
|
return typeof bustStorageOnInit === 'function'
|
||||||
? bustStorageOnInit(preservedSideValue, refWidth)
|
? bustStorageOnInit(preservedSideValue, refSize)
|
||||||
: !!bustStorageOnInit;
|
: !!bustStorageOnInit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue