diff --git a/lib/adapters/choo.js b/lib/adapters/choo.js index fbf4689..a7b1ea3 100644 --- a/lib/adapters/choo.js +++ b/lib/adapters/choo.js @@ -12,6 +12,9 @@ function plugin (parent, options) { // content state state.site = state.site || { loaded: false, p2p: false } state.content = state.content || { } + + // check if the content was preloaded + state.site.loaded = state.site.preloaded === true // nanopage state.page = new Page(state) @@ -21,8 +24,11 @@ function plugin (parent, options) { state.events.CONTENT_LOAD = 'content:load' // listeners - emitter.on(state.events.DOMCONTENTLOADED, contentLoad) emitter.on(state.events.CONTENT_LOAD, contentLoad) + // only load the content if it wasn't rehydrated by the server + if (!state.site.loaded) { + emitter.on(state.events.DOMCONTENTLOADED, contentLoad) + } /** * primary method diff --git a/readme.md b/readme.md index dd56025..d59a462 100644 --- a/readme.md +++ b/readme.md @@ -63,7 +63,7 @@ function view (state, emit) { ` } } -``` +``` @@ -161,4 +161,4 @@ For specifics on formatting directories and files, take a look at the dependenci ## Contributing -Enoki is early in development. If you’d like to see support for webpack, or whatever other tooling, feel free to contribute! \ No newline at end of file +Enoki is early in development. If you’d like to see support for webpack, or whatever other tooling, feel free to contribute!