u
This commit is contained in:
@@ -145,6 +145,27 @@ export function disposeAllCategoryViewAutomats() {
|
||||
categoryViews.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parsed category map and root id, or `null` while the tree is
|
||||
* still loading. Replaces the former `StorageManager.getCategoryState()`.
|
||||
*
|
||||
* @returns {{ categories: Record<string,object>, rootCategoryId: unknown }|null}
|
||||
*/
|
||||
export function getCategoryState() {
|
||||
const state = categoryAutomat.state;
|
||||
if (state.categories == null || state.treeStatus !== 'succeeded') return null;
|
||||
return { categories: state.categories, rootCategoryId: state.rootCategoryId };
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves once the category tree has loaded.
|
||||
*
|
||||
* @returns {Promise<CategoryState>} State with `treeStatus === 'succeeded'`.
|
||||
*/
|
||||
export function whenCategoryTreeReady() {
|
||||
return waitForCategoryTree();
|
||||
}
|
||||
|
||||
// ─── Actions ───────────────────────────────────────────────────────────────────
|
||||
|
||||
const actions = {
|
||||
|
||||
Reference in New Issue
Block a user