Skip to content

Commit

Permalink
fix(Tenant): fix tree not fully collapsed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
artemmufazalov committed Oct 11, 2023
1 parent ab21c37 commit 388a1cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions src/containers/Tenant/ObjectSummary/ObjectSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ import './ObjectSummary.scss';

const b = cn('object-summary');

const getInitialIsSummaryCollapsed = () => {
return Boolean(localStorage.getItem(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED));
};
const getTenantCommonInfoState = () => {
const collapsed = Boolean(localStorage.getItem(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED));

const initialTenantCommonInfoState = {
triggerExpand: false,
triggerCollapse: false,
collapsed: getInitialIsSummaryCollapsed(),
return {
triggerExpand: false,
triggerCollapse: false,
collapsed,
};
};

function prepareOlapTableSchema(tableSchema: TColumnTableDescription = {}) {
Expand Down Expand Up @@ -109,7 +109,8 @@ export function ObjectSummary({
const dispatch = useDispatch();
const [commonInfoVisibilityState, dispatchCommonInfoVisibilityState] = useReducer(
paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED),
initialTenantCommonInfoState,
undefined,
getTenantCommonInfoState,
);
const {
data,
Expand Down
17 changes: 9 additions & 8 deletions src/containers/Tenant/Tenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import './Tenant.scss';

const b = cn('tenant-page');

const getInitialIsSummaryCollapsed = () => {
return Boolean(localStorage.getItem(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED));
};
const getTenantSummaryState = () => {
const collapsed = Boolean(localStorage.getItem(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED));

const initialTenantSummaryState = {
triggerExpand: false,
triggerCollapse: false,
collapsed: getInitialIsSummaryCollapsed(),
return {
triggerExpand: false,
triggerCollapse: false,
collapsed,
};
};

interface TenantProps {
Expand All @@ -45,7 +45,8 @@ interface TenantProps {
function Tenant(props: TenantProps) {
const [summaryVisibilityState, dispatchSummaryVisibilityAction] = useReducer(
paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED),
initialTenantSummaryState,
undefined,
getTenantSummaryState,
);

const {currentSchemaPath, currentSchema: currentItem = {}} = useSelector(
Expand Down

0 comments on commit 388a1cf

Please sign in to comment.