Skip to content

Commit

Permalink
fix(client): fix view
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jan 20, 2021
1 parent 74b7c75 commit 0afcae8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/components/ContentView/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function setupMermaid() {
}

export const Base = memo(
({ slides, onChangeSlideIndex, hash, isJumpPage }) => {
({ slides, onChangeSlideIndex, hash, isJumpPage, showIndex }) => {
// for SSR
if (process.env.NODE_ENV !== 'production') {
useEffect(() => {
Expand Down Expand Up @@ -60,7 +60,7 @@ export const Base = memo(

function setupSlides() {
if (!window.slide) {
window.slide = setupWebSlides({});
window.slide = setupWebSlides({ showIndex });

// for presenter:view
window.slide.el.addEventListener('ws:slide-change', (e) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/components/ContentView/Host.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
if (!presentationController) {
const { origin, pathname } = new URL(window.location);

slideUrl = `${origin}/${pathname}?sidebar=false&isLive=false#slide=`;
slideUrl = `${origin}${pathname}?sidebar=false&isLive=false#slide=`;
presentationController = new PresentationController();
}

Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/hooks/useContentComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useEffect, useState } from 'react';
import { Base } from '../components/ContentView/Base';

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

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

setContentComponent(Comp);
} else {
setContentComponent(null);
}
})();
}, [mode]);
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/presentationMode/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export class Controller {
}

async reconnect(id) {
if (this.apiType === 'presentation') return this.presentationRequest.reconnect(id);
if (this.apiType === 'presentation') {
return this.presentationRequest.reconnect(id);
}

return Promise.resolve();
}

Expand Down

0 comments on commit 0afcae8

Please sign in to comment.