Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sneakers-the-rat opened this issue Aug 1, 2022 · 1 comment · Fixed by #1186 or #1163
Closed

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

sneakers-the-rat opened this issue Aug 1, 2022 · 1 comment · Fixed by #1186 or #1163
Assignees

Comments

@sneakers-the-rat
Copy link
Contributor

sneakers-the-rat commented Aug 1, 2022

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'))
@AaronPowell96
Copy link
Contributor

@sneakers-the-rat Hopefully this fix allows you to link to specific slides again! Please reach out if you have further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants