Skip to content

Add localStorage prop#36

Open
mxstbr wants to merge 1 commit intojamiebuilds:masterfrom
mxstbr:local-storage-prop
Open

Add localStorage prop#36
mxstbr wants to merge 1 commit intojamiebuilds:masterfrom
mxstbr:local-storage-prop

Conversation

@mxstbr
Copy link

@mxstbr mxstbr commented May 14, 2017

I've found myself going on stage, starting my presentation in front of my crowd and all of my code slides being at the wrong location because their state was stored to localStorage.

I can't think of a reason I'd want to keep the state of the slides between practice runs and the real deal, so I've added a prop to disable that behaviour. (localStorage, with the default being the current behaviour)

Otherwise it's impossible to disable storing the state of the slide.
@mxstbr
Copy link
Author

mxstbr commented May 14, 2017

If I missed something and we need this to be stored during the current session (maybe some re-render?) could we switch to sessionStorage? That way I don't get the old state when presenting for realz.

@mxstbr mxstbr closed this May 14, 2017
@mxstbr mxstbr reopened this May 14, 2017
@jamiebuilds
Copy link
Owner

Without local storage the presenter doesn't stay in sync. The real solution is to send messages somehow instead.

@mxstbr
Copy link
Author

mxstbr commented May 15, 2017

Ohh that's what it's for! That makes sense, hmm...

@elijahmanor
Copy link

elijahmanor commented May 23, 2017

@mxstbr You could try adding a localStorage.clear() in your Presentation class constructor. That'll clear out the storage on a full page load or refresh. If you are in presentation mode and do a page refresh, they'll get back in sync on the next action on either tab. There is probably a better way to do this, but for now it is my current setup.

export default class Presentation extends React.Component {
  constructor(props) {
    super(props);
    localStorage.clear();
  }
  render() { /* ... */ }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants