Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce clearNavigationCache() to clear children and titleResolver cache #2383

Merged
merged 3 commits into from
Nov 18, 2021

Conversation

stanleychh
Copy link
Contributor

Description

Provide a core API to clean nodeData cache for children resolution and titleResolver cache.
Luigi.clearNavigationCache()

Related issue(s)
Fixes #2379

Draft PR: #2380

@stanleychh stanleychh changed the title Clear children and titleResolver cache Introduce clearNavigationCache() to clear children and titleResolver cache Nov 18, 2021
@JohannesDoberer JohannesDoberer added this to the Sprint 22 milestone Nov 18, 2021
@wdoberschuetz wdoberschuetz self-assigned this Nov 18, 2021
Comment on lines +291 to 309
clearNavigationCache() {
NodeDataManagementStorage.deleteCache();

const clearTitleResolverCache = nodes => {
if (nodes && nodes.forEach) {
nodes.forEach(node => {
if (node.titleResolver && node.titleResolver._cache) {
node.titleResolver._cache = undefined;
}
if (node.children) {
clearTitleResolverCache(node.children);
}
});
}
};

clearTitleResolverCache(this.getConfig().navigation.nodes);
}
}
Copy link
Contributor

@wdoberschuetz wdoberschuetz Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(q) We clear the cache of the nested navigation nodes - shouldn't we return a warning of some kind of any of the nodes do not meet the criteria (i.e. titleResolver doesn't exist in the node) within the ifs? I presume it makes no sense because we can only clean caches if the titleResolver already exists... but my questions stands - should we inform somehow anything/anybody that it's been cleaned or (not) cleaned? :)

@hardl hardl merged commit d48229a into SAP:master Nov 18, 2021
@JohannesDoberer JohannesDoberer added the enhancement New feature or request label Nov 26, 2021
@JohannesDoberer JohannesDoberer mentioned this pull request Nov 26, 2021
stanleychh added a commit to stanleychh/luigi that referenced this pull request Dec 30, 2021
…cache (SAP#2383)

* Clear children and titleResolver cache

* Update the description of clearNavigationCache()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose functionality in core api to clear navigation related caches
4 participants