Merge pull request #514 from buster-so/staging

Staging to main hot fixes
This commit is contained in:
Nate Kelley 2025-07-14 15:11:12 -06:00 committed by GitHub
commit a690e1aa81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View File

@ -47,8 +47,13 @@ export const AppVerticalCodeSplitter = forwardRef<AppSplitterRef, AppVerticalCod
const dataContainerClassName = !topHidden ? `pt-${gapAmount}` : '';
const bustStorageOnInit = useMemoizedFn(
(preservedSideValue: number | null, refWidth: number) => {
return !preservedSideValue || preservedSideValue < 80 || refWidth < 120;
(preservedSideValue: number | null, refSize: number) => {
return (
!preservedSideValue ||
preservedSideValue < 80 ||
refSize < 120 ||
preservedSideValue > refSize - 80
);
}
);

View File

@ -125,7 +125,7 @@ interface IAppSplitterProps {
* 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
*/
bustStorageOnInit?: boolean | ((preservedSideValue: number | null, refWidth: number) => boolean);
bustStorageOnInit?: boolean | ((preservedSideValue: number | null, refSize: number) => boolean);
/**
* Whether to render the left panel content
@ -302,15 +302,18 @@ const AppSplitterBase = forwardRef<
// ================================
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
if (!refWidth || refWidth === 0) {
if (!refSize || refSize === 0) {
// console.warn('AppSplitter: container not sized yet');
return false;
}
return typeof bustStorageOnInit === 'function'
? bustStorageOnInit(preservedSideValue, refWidth)
? bustStorageOnInit(preservedSideValue, refSize)
: !!bustStorageOnInit;
};