formsSubstore
Manages the paginated list of available forms from the API, along with all filtering (category, search) and pagination state. Any change to a filter automatically resets the page to 1.
Table of contents
Properties
- paginatedFormsData
- masterCategoryId
- superCategoryId
- categoryId
- noCategory
- search
- size
- page
- totalPages
Methods
- setNextPage
- setPreviousPage
- setPage
- setCategoryIdByType
- unsetCategoryIdByType
- setNoCategory
- setSearch
- prefetchForms
Properties
paginatedFormsData
paginatedFormsData: ApiResource<TApiFormsPaginated>Paginated list of forms from the API, including loading and error state.
TApiFormsPaginated contains a content array of form summaries plus pagination metadata (totalPages, totalElements, etc.). Re-fetched automatically whenever any filter or pagination state changes. See ApiResource for the loading/error shape.
Related
page,size— pagination controlssearch,categoryId,masterCategoryId,superCategoryId,noCategory— filter controlstotalPages— synced from the API responseformCategoriesSubstore.findFormsByCurrentCategory— triggers a category filter update
masterCategoryId
masterCategoryId?: numberCurrently active master-category filter.
When set, only forms belonging to the given master category are returned. Cleared by unsetCategoryIdByType. Mutually exclusive with superCategoryId and categoryId — setting one resets the others.
Related
setCategoryIdByType— setterunsetCategoryIdByType— clears the active filter
superCategoryId
superCategoryId?: numberCurrently active super-category filter.
When set, only forms belonging to the given super category are returned. See masterCategoryId for mutual-exclusivity behaviour.
Related
setCategoryIdByType— setterunsetCategoryIdByType— clears the active filter
categoryId
categoryId?: numberCurrently active category filter.
When set, only forms belonging to the given category are returned. See masterCategoryId for mutual-exclusivity behaviour.
Related
setCategoryIdByType— setterunsetCategoryIdByType— clears the active filter
noCategory
noCategory: booleanWhen true, only forms with no category are shown.
Toggled by setNoCategory. Resets page to 1 on change.
Related
setNoCategory— setter
search
search: stringCurrent free-text search string used to filter the forms list.
An empty string means no search filter is active. Updated by setSearch, which also resets page to 1.
Related
setSearch— setter
size
size: numberNumber of forms to fetch per page.
Default value is set during store initialisation. Changing this triggers a re-fetch.
Related
page
page: numberCurrent page number (1-based).
Changed by setNextPage, setPreviousPage, and setPage. Automatically reset to 1 by any filter change.
Related
totalPages
totalPages: numberTotal number of pages based on the last API response.
Synced from the TApiFormsPaginated response payload. Used as the upper bound in setNextPage.
Related
pagepaginatedFormsData— source of this value
Methods
setNextPage
setNextPage: () => voidAdvances to the next page, capped at totalPages.
Does nothing when page is already equal to totalPages.
Related
setPreviousPage
setPreviousPage: () => voidGoes back one page, capped at 1.
Does nothing when page is already 1.
Related
setPage
setPage: (page: number) => voidSets the current page to an arbitrary number.
Parameters
| Name | Type | Description |
|---|---|---|
page | number | Target page number (1-based) |
Related
setCategoryIdByType
setCategoryIdByType: ( args: | { masterCategoryId: number } | { superCategoryId: number } | { categoryId: number },) => voidSets a master-, super-, or category-level filter and resets pagination to page 1.
Pass exactly one of the three keys. The other two category filters are cleared automatically.
Parameters
| Name | Type | Description |
|---|---|---|
args | { masterCategoryId: number } | { superCategoryId: number } | { categoryId: number } | The filter to apply |
Related
masterCategoryId,superCategoryId,categoryIdunsetCategoryIdByType— clears the active filterformCategoriesSubstore.findFormsByCurrentCategory— calls this internally
unsetCategoryIdByType
unsetCategoryIdByType: () => voidClears the active category filter and resets pagination to page 1.
Clears whichever of masterCategoryId, superCategoryId, or categoryId is currently set.
Related
masterCategoryId,superCategoryId,categoryIdformCategoriesSubstore.findFormsByCurrentCategory— calls this when no category is selected
setNoCategory
setNoCategory: (noCategory: boolean) => voidToggles the “no-category” filter and resets pagination to page 1.
Parameters
| Name | Type | Description |
|---|---|---|
noCategory | boolean | true to show only forms without a category |
Related
setSearch
setSearch: (search: string) => voidUpdates the free-text search string used to filter forms.
Resets page to 1 on change.
Parameters
| Name | Type | Description |
|---|---|---|
search | string | Search string (empty string clears the filter) |
Related
prefetchForms
prefetchForms: (args: { masterCategoryId?: number; superCategoryId?: number; categoryId?: number;}) => voidPrefetches forms for a given category combination without affecting the current displayed state.
Use this to warm the cache before the user navigates to a category (e.g., on hover). The prefetched data is stored in the query cache and used automatically when the user activates the matching filter.
Parameters
| Name | Type | Description |
|---|---|---|
args.masterCategoryId | number (optional) | Master category to prefetch |
args.superCategoryId | number (optional) | Super category to prefetch |
args.categoryId | number (optional) | Category to prefetch |
Related
paginatedFormsData— the data source that benefits from prefetchingformCategoriesSubstore.strategies— a good place to trigger prefetching on hover