Skip to content

Commit

Permalink
Add treeFor cache
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 14, 2021
1 parent 000552c commit 29d80a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"broccoli-node-api": "^1.7.0",
"broccoli-plugin": "^4.0.3",
"broccoli-source": "^3.0.0",
"calculate-cache-key-for-tree": "2.0.0",
"debug": "^4.3.1",
"ember-cli-babel": "^7.23.1",
"ember-cli-htmlbars": "^5.3.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/ember/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DemoComponentChunk } from './plugins/types';
import docfyOutputTemplate from './docfy-output-template';
import getDocfyConfig from './get-config';
import { isDemoComponents } from './plugins/utils';
import cacheKeyForTree from 'calculate-cache-key-for-tree';
import debugFactory from 'debug';
const debug = debugFactory('@docfy/ember');

Expand Down Expand Up @@ -134,6 +135,12 @@ module.exports = {
this._super.included.apply(this, args);
},

// Re-enables caching of this addon, due to opting out
// of the caching implicitly by specifying treeFor* methods
cacheKeyForTree(treeType) {
return cacheKeyForTree(treeType, this);
},

treeForApp(tree: Node): Node {
const trees: Node[] = [this._super.treeForApp.call(this, tree)];
if (isDeepAddonInstance(this)) {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5678,7 +5678,7 @@ cacheable-request@^2.1.1:
normalize-url "2.0.1"
responselike "1.0.2"

calculate-cache-key-for-tree@^2.0.0:
calculate-cache-key-for-tree@2.0.0, calculate-cache-key-for-tree@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/calculate-cache-key-for-tree/-/calculate-cache-key-for-tree-2.0.0.tgz#7ac57f149a4188eacb0a45b210689215d3fef8d6"
integrity sha512-Quw8a6y8CPmRd6eU+mwypktYCwUcf8yVFIRbNZ6tPQEckX9yd+EBVEPC/GSZZrMWH9e7Vz4pT7XhpmyApRByLQ==
Expand Down

0 comments on commit 29d80a3

Please sign in to comment.