Skip to content

Commit

Permalink
Merge pull request #13165 from storybookjs/13156-fix-cached-manager
Browse files Browse the repository at this point in the history
Core: Fix using cached manager on the 2nd run
  • Loading branch information
shilman committed Nov 19, 2020
2 parents 4747fea + 74693f4 commit 76d53b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/core/src/server/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,17 @@ const startManager = async ({

if (options.cache) {
if (options.managerCache) {
const configString = stringify(managerConfig);
// Drop the `cache` property because it'll change as a result of writing to the cache.
const { cache: _, ...baseConfig } = managerConfig;
const configString = stringify(baseConfig);
const cachedConfig = await options.cache.get('managerConfig');
options.cache.set('managerConfig', configString);
if (configString === cachedConfig && (await pathExists(outputDir))) {
logger.info('=> Using cached manager');
managerConfig = null;
}
} else {
logger.info('=> Removing cached managerConfig');
options.cache.remove('managerConfig');
}
}
Expand Down

0 comments on commit 76d53b5

Please sign in to comment.