From ce7e2cb2b503357dd02d88dc791d5643257b1c7e Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Tue, 27 Feb 2024 13:38:26 +0300 Subject: [PATCH] fix: Fix loading state --- src/components/DocPage/DocPage.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/DocPage/DocPage.tsx b/src/components/DocPage/DocPage.tsx index f88aeabe..eb4038a0 100644 --- a/src/components/DocPage/DocPage.tsx +++ b/src/components/DocPage/DocPage.tsx @@ -84,14 +84,18 @@ type DocPageState = { class DocPage extends React.Component { static defaultProps: DocSettings = DEFAULT_SETTINGS; - state: DocPageState = { - loading: true, - keyDOM: getRandomKey(), - }; - + state: DocPageState; bodyRef: HTMLDivElement | null = null; bodyObserver: MutationObserver | null = null; + constructor(props: DocPageInnerProps) { + super(props); + + this.state = { + loading: props.singlePage, + keyDOM: getRandomKey(), + }; + } componentDidMount(): void { const {singlePage} = this.props;