Skip to content

URLs for slide broken, slideshow always starts at 0 on load/refresh. #1171

@sneakers-the-rat

Description

@sneakers-the-rat

Describe Your Environment

What version of Spectacle are you using? (can be found by running npm list spectacle)

Fresh clone & install of 8dac6a3

(by the way this is broken too. had to manually install pnpm)

yarn add pnpm
npx pnpm install
npx pnpm start:js

What browser are you using?
Tested on Firefox and Chrome

What machine are you on?
macOS and android

Describe the Problem

True of any slideshow I try, including the examples in the repository:

Opening a slideshow and navigating to another slide, eg. http://localhost:3000/?slideIndex=2&stepIndex=0, and then refreshing will take me back to the 0th slide. Going to the link directly also boots me back to the beginning of the slideshow. This sort of sucks a lot and breaks one of the major reasons why I use this -- being able to link directly to specific slides.

I think it might have something to do with slide 0, step 0 being hardcoded in the deck's usage of location sync....

useEffect(() => {
const initialView = syncLocation({
slideIndex: 0,
stepIndex: 0
});
initializeTo(initialView);
}, [initializeTo, syncLocation]);

edit: was able to resolve the problem by reverting to the old style ReactDOM usage.

ie. rather than

import { createRoot } from 'react-dom/client';

const container = document.getElementById('root')
const root = createRoot(container);
root.render(<Presentation />);

using

import ReactDOM from 'react-dom'

ReactDOM.render(<Presentation />, document.getElementById('root'))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions