Skip to content

Commit

Permalink
fix(v2): fix hot reload sometimes not working due to altered modules (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
endiliey authored Apr 18, 2019
1 parent 1ce4195 commit b4daac9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/docusaurus/lib/client/exports/ComponentCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import registry from '@generated/registry';

function ComponentCreator(path) {
const modules = routesAsyncModules[path];
const originalModules = modules;
const optsModules = [];
const optsWebpack = [];
const mappedModules = {};
Expand Down Expand Up @@ -63,8 +62,8 @@ function ComponentCreator(path) {
modules: optsModules,
webpack: () => optsWebpack,
render: (loaded, props) => {
// Transform back loaded modules back into the original structure.
const loadedModules = originalModules;
// clone the original object since we don't want to alter the original.
const loadedModules = JSON.parse(JSON.stringify(modules));
Object.keys(loaded).forEach(key => {
let val = loadedModules;
const keyPath = key.split('.');
Expand Down

0 comments on commit b4daac9

Please sign in to comment.