formCategoriesSubstore
Manages the hierarchical category tree used to browse and filter forms. Provides both raw state (path, current category) and two ready-to-use UI strategies — breadcrumbs for drill-down navigation and filter for flat category selection.
Table of contents
Properties
Methods
Properties
formCategories
formCategories: ApiResource<TCategoriesTree[]>API resource containing the hierarchical category tree, including loading and error state.
Each TCategoriesTree node has an id, a name, and a children array of nested sub-categories. The tree is fetched once and cached. See ApiResource for the shape of loading/error state.
Related
currentCategory— the currently selected node from this treecategoriesPath— breadcrumb path into this treestrategies— pre-built helpers that consume this data
categoriesPath
categoriesPath: TCategoriesTree[]The current navigation breadcrumb path of selected categories, from root to current.
Updated automatically by setCurrentCategory. The first element is the root category, the last element is the currentCategory. An empty array means no category is selected.
Related
currentCategory— the last item in this arraysetCurrentCategory— updates both this array andcurrentCategorystrategies—breadcrumbsstrategy exposes this directly
currentCategory
currentCategory: TCategoriesTree | undefinedThe currently active/selected category, or undefined when none is selected.
When undefined, the forms list is unfiltered by category. Setting a category via setCurrentCategory also updates categoriesPath.
Related
categoriesPath— path leading to this categorysetCurrentCategory— setterfindFormsByCurrentCategory— applies this category as a filter on the forms list
strategies
strategies: { breadcrumbs: (args: { homeText: string }) => { formCategories: TCategoriesTree[]; categoriesPath: TCategoriesTree[]; shouldShowForms: boolean; currentCategory: TCategoriesTree; setCurrentCategory: (category: TCategoriesTree) => void; back: () => void; }; filter: (args: { allText: string }) => { formCategories: TCategoriesTree[]; categoriesPath: TCategoriesTree[]; currentCategory: TCategoriesTree; setCurrentCategory: (category: TCategoriesTree) => void; isSelectedCategory: (category: TCategoriesTree) => boolean; };}Pre-built UI interaction strategies for category navigation.
strategies.breadcrumbs
Drill-down navigation pattern. The user selects a category to go deeper; a back() helper navigates up one level. shouldShowForms is true when the current category has no children (leaf node) — use this to decide whether to render the forms list or the sub-category list.
| Property | Type | Description |
|---|---|---|
formCategories | TCategoriesTree[] | Root-level categories |
categoriesPath | TCategoriesTree[] | Breadcrumb trail from root to current |
shouldShowForms | boolean | true when at a leaf category |
currentCategory | TCategoriesTree | Active category (uses home if none selected) |
setCurrentCategory | (c) => void | Navigate into a category |
back | () => void | Navigate up one level |
strategies.filter
Flat filter pattern. All root categories are shown simultaneously; clicking one toggles the forms filter. isSelectedCategory returns true for the currently active category.
| Property | Type | Description |
|---|---|---|
formCategories | TCategoriesTree[] | Root-level categories |
categoriesPath | TCategoriesTree[] | Current breadcrumb path |
currentCategory | TCategoriesTree | Active category |
setCurrentCategory | (c) => void | Select / deselect a category |
isSelectedCategory | (c) => boolean | Returns true if c is the active category |
Related
formCategories— data source for both strategiescategoriesPath— exposed by both strategiesformsSubstore.paginatedFormsData— the forms list filtered by strategy actions
Methods
setCurrentCategory
setCurrentCategory: (category: TCategoriesTree | undefined) => voidSets the current category and updates the breadcrumb path accordingly.
Passing undefined clears the selection and resets categoriesPath to [].
Parameters
| Name | Type | Description |
|---|---|---|
category | TCategoriesTree | undefined | Category to select, or undefined to clear |
Related
currentCategory— updated by this callcategoriesPath— updated by this call
findFormsByCurrentCategory
findFormsByCurrentCategory: () => voidApplies the current category as a filter on the forms list.
Reads currentCategory and calls the appropriate method on formsSubstore to update the category filter. If no category is selected, the filter is cleared.
Related
currentCategory— used to determine which filter to applyformsSubstore.setCategoryIdByType— called internally with the current category’s IDformsSubstore.unsetCategoryIdByType— called when no category is selected