Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit fc7137a

Browse files
committed
fix(client): fix host logic
1 parent 0d172bc commit fc7137a

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

packages/client/src/components/AppContainer.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ import { MdMenu } from 'react-icons/md';
33
import { createSlidesProps } from '../utils/createSlidesProps';
44
import { useCurrentIndex } from '../hooks/useCurrentIndex';
55
import { useMode } from '../hooks/useMode';
6+
import { useSlidesProps } from '../hooks/useSlides';
67
import { useContentComponent } from '../hooks/useContentComponent';
78
import { useSidebarComponent } from '../hooks/useSidebarComponent';
89
import { useCommentsListComponent } from '../hooks/useCommentsListComponent';
910

1011
export const AppContainer = ({ slides: originalSlides, hash }) => {
1112
const [isOpenSidebar, updateOpenSidebarStatus] = useState(false);
1213
const [currentIndex, setCurrentIndex] = useCurrentIndex();
13-
const createdProps = useMemo(() => createSlidesProps(originalSlides, currentIndex), [hash]);
14-
const slides = useMemo(() => createdProps.slides, [hash]);
15-
const contentsList = useMemo(() => createdProps.contentsList, [hash]);
14+
const { slides, contentsList } = useSlidesProps({ originalSlides, hash, currentIndex });
1615
const [mode, setMode] = useMode();
1716
const ContentComponent = useContentComponent(mode);
1817
const SidebarComponent = useSidebarComponent(mode);

packages/client/src/components/ContentView/Host.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
188188
if (!presentationController) {
189189
throw new Error('Not found PresenterController.');
190190
}
191-
// presentationApiId = await presentationController.openView();
191+
await presentationController.openView();
192192
} catch (e) {
193193
console.error(e);
194194
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useMemo } from 'react';
2+
import { createSlidesProps } from '../utils/createSlidesProps';
3+
4+
export function useSlidesProps({ originalSlides, hash, currentIndex }) {
5+
const createdProps = useMemo(() => createSlidesProps(originalSlides, currentIndex), [hash]);
6+
const slides = useMemo(() => createdProps.slides, [hash]);
7+
const contentsList = useMemo(() => createdProps.contentsList, [hash]);
8+
9+
return {
10+
slides,
11+
contentsList,
12+
};
13+
}

0 commit comments

Comments
 (0)