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

Commit 0afcae8

Browse files
committed
fix(client): fix view
1 parent 74b7c75 commit 0afcae8

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function setupMermaid() {
2020
}
2121

2222
export const Base = memo(
23-
({ slides, onChangeSlideIndex, hash, isJumpPage }) => {
23+
({ slides, onChangeSlideIndex, hash, isJumpPage, showIndex }) => {
2424
// for SSR
2525
if (process.env.NODE_ENV !== 'production') {
2626
useEffect(() => {
@@ -60,7 +60,7 @@ export const Base = memo(
6060

6161
function setupSlides() {
6262
if (!window.slide) {
63-
window.slide = setupWebSlides({});
63+
window.slide = setupWebSlides({ showIndex });
6464

6565
// for presenter:view
6666
window.slide.el.addEventListener('ws:slide-change', (e) => {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
4444
if (!presentationController) {
4545
const { origin, pathname } = new URL(window.location);
4646

47-
slideUrl = `${origin}/${pathname}?sidebar=false&isLive=false#slide=`;
47+
slideUrl = `${origin}${pathname}?sidebar=false&isLive=false#slide=`;
4848
presentationController = new PresentationController();
4949
}
5050

packages/client/src/hooks/useContentComponent.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { useEffect, useState } from 'react';
22
import { Base } from '../components/ContentView/Base';
33

44
export function useContentComponent(mode) {
5-
const [ContentComponent, setContentComponent] = useState(Base);
5+
// need to set the default value for SSR
6+
const [ContentComponent, setContentComponent] = useState(mode === 'common' ? Base : null);
67

78
useEffect(() => {
89
(async () => {
@@ -16,6 +17,8 @@ export function useContentComponent(mode) {
1617
const { default: Comp } = await import('../components/ContentView/Host');
1718

1819
setContentComponent(Comp);
20+
} else {
21+
setContentComponent(null);
1922
}
2023
})();
2124
}, [mode]);

packages/client/src/presentationMode/Controller.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export class Controller {
4141
}
4242

4343
async reconnect(id) {
44-
if (this.apiType === 'presentation') return this.presentationRequest.reconnect(id);
44+
if (this.apiType === 'presentation') {
45+
return this.presentationRequest.reconnect(id);
46+
}
47+
4548
return Promise.resolve();
4649
}
4750

0 commit comments

Comments
 (0)