mirror of https://github.com/buster-so/buster.git
Update useMetricLayout.ts
This commit is contained in:
parent
55e307b677
commit
2fc8c9a221
|
@ -28,25 +28,27 @@ export const useMetricLayout = ({
|
||||||
const defaultOpenLayout = isChart ? defaultChartOpenLayout : defaultSqlOpenLayout;
|
const defaultOpenLayout = isChart ? defaultChartOpenLayout : defaultSqlOpenLayout;
|
||||||
const defaultOriginalLayout = isChart ? defaultChartLayout : defaultSqlLayout;
|
const defaultOriginalLayout = isChart ? defaultChartLayout : defaultSqlLayout;
|
||||||
|
|
||||||
const secondaryLayoutDimensions = useMemo(() => {
|
const secondaryLayoutDimensions: [string, string] = useMemo(() => {
|
||||||
const cookieKey = createAutoSaveId(autoSaveId);
|
const cookieKey = createAutoSaveId(autoSaveId);
|
||||||
const cookieValue = Cookies.get(cookieKey);
|
const cookieValue = Cookies.get(cookieKey);
|
||||||
if (cookieValue) {
|
if (cookieValue) {
|
||||||
try {
|
try {
|
||||||
const parsedValue = JSON.parse(cookieValue);
|
const parsedValue = JSON.parse(cookieValue) as string[];
|
||||||
return parsedValue;
|
if (!parsedValue?.some((item) => item === 'auto')) {
|
||||||
|
return parsedValue as [string, string];
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultOpenLayout;
|
return defaultOpenLayout as [string, string];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const defaultLayout = useMemo(() => {
|
const defaultLayout: [string, string] = useMemo(() => {
|
||||||
if (isOpenSecondary) {
|
if (isOpenSecondary) {
|
||||||
return secondaryLayoutDimensions;
|
return secondaryLayoutDimensions;
|
||||||
}
|
}
|
||||||
return defaultOriginalLayout;
|
return defaultOriginalLayout as [string, string];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const animateOpenSplitter = useMemoizedFn((side: 'metric' | 'both') => {
|
const animateOpenSplitter = useMemoizedFn((side: 'metric' | 'both') => {
|
||||||
|
|
Loading…
Reference in New Issue