Skip to content

Commit a9ddaf8

Browse files
committed
fixup! ✨(frontend) improve mobile UX by showing subdocs count
1 parent 938d8d6 commit a9ddaf8

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/frontend/apps/impress/src/features/docs/doc-header/components/DocHeaderInfo.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,25 @@ import {
1313
useIsCollaborativeEditable,
1414
useTrans,
1515
} from '../../doc-management';
16-
import { useDocChildren, useDocTree } from '../../doc-tree';
1716

1817
interface DocHeaderInfoProps {
1918
doc: Doc;
2019
}
2120

2221
export const DocHeaderInfo = ({ doc }: DocHeaderInfoProps) => {
23-
const { data: tree } = useDocTree({ docId: doc.id });
2422
const { isDesktop } = useResponsiveStore();
2523
const treeContext = useTreeContext<Doc | null>();
2624
const { transRole } = useTrans();
2725
const { isEditable } = useIsCollaborativeEditable(doc);
2826
const { relativeDate, calculateDaysLeft } = useDate();
2927
const { data: config } = useConfig();
3028

31-
const { data: childrenPage } = useDocChildren(
32-
{ docId: doc.id, page_size: 1 },
33-
{ enabled: true },
34-
);
3529
const countFromTreeContext =
3630
treeContext?.root?.id === doc.id
3731
? treeContext?.treeData?.nodes?.length
3832
: undefined;
3933

40-
const childrenCount =
41-
countFromTreeContext ??
42-
childrenPage?.count ??
43-
doc.numchild ??
44-
tree?.children?.length ??
45-
0;
34+
const childrenCount = countFromTreeContext ?? doc.numchild ?? 0;
4635

4736
let dateToDisplay = t('Last update: {{update}}', {
4837
update: relativeDate(doc.updated_at),

0 commit comments

Comments
 (0)