diff --git a/components/Editor.js b/components/Editor.js index d746158..096bc26 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -205,7 +205,7 @@ class Editor extends React.Component { resetDefaultSettings() { this.setState(DEFAULT_SETTINGS) - localStorage.clear() + this.props.onReset() } upload() { @@ -374,7 +374,8 @@ function readAs(file) { Editor.defaultProps = { api: {}, - onUpdate: () => {} + onUpdate: () => {}, + onReset: () => {} } export default DragDropContext(HTML5Backend)(Editor) diff --git a/pages/index.js b/pages/index.js index bbf1466..6fa2ddc 100644 --- a/pages/index.js +++ b/pages/index.js @@ -20,13 +20,24 @@ class Index extends React.Component { } render() { - const { router } = this.props return ( - + ) } } +function onReset() { + localStorage.clear() + + if (window.navigator && navigator.serviceWorker) { + navigator.serviceWorker.getRegistrations().then(registrations => { + for (let registration of registrations) { + registration.unregister() + } + }) + } +} + export default withRouter(Index)