new GridPresenterBase() → {GridPresenterBase}
Constructor - view is set later via onInit()
| Name | Type | Description |
|---|---|---|
view | dynamic | Reference to the BaseGridView component |
log | dynamic | Reference to the log instance |
apiFilters | dynamic | Cached filter options from API (invalid = not loaded, {} = load failed) |
filtersLoadedFor | dynamic | Which library m.apiFilters holds a SUCCESSFUL load for, "" when none. This is the ' cache, and the reason one exists: the filter lists are needed only if the user opens ' the options panel, but loadFilters() is reached from configureLoadTask(), which runs ' on every query build: every sort change, filter change, view change, alpha letter ' and voice search. Without this, browsing a library refetches both filter endpoints ' repeatedly for data most sessions never look at, competing with the grid's own load ' on a contended render thread (see docs/architecture/async.md). |
filtersInFlightFor | dynamic | The library a fetch is CURRENTLY in flight for, "" when none. Separate from the cache ' because a request that has not answered yet is neither loaded nor absent, and because ' fetchAsync keys its pending registry by requestId: two overlapping loads of the same ' library would collide on "filters- |
filtersRequest | dynamic | What refreshFilters() needs to repeat the last request. Unset on a presenter with no ' dynamic filters, which is what makes refreshFilters() a no-op there. |
- Type:
- GridPresenterBase
Methods
configureLoadTask(task, parentItem, viewMode, _task, _parentItem, _viewMode) → {void}
Configures the LoadItemsTask2 query for data loading
| Name | Type | Description |
|---|---|---|
task | object | The query: an AA of LoadItemsTask2 input fields, not the node (BaseGridView runs each load on a new node; see gridQuery.build). Assign fields only. |
parentItem | object | The library item being displayed |
viewMode | string | Current view mode (for example "Movies", "MoviesGrid") |
_task | object | |
_parentItem | object | |
_viewMode | string |
- Type:
- void
(protected) currentView() → {string}
The view mode the grid is currently showing, or "" when it cannot be read.
getOptions() receives the parent item but not the view, and some of its lists depend on which view is up (a Collections view sorts BoxSets, not movies), so the view is read back off the host component. BaseGridView keeps currentView in step with its own m.view (it sets it in loadInitialItems before SetUpOptions runs, and again in optionsClosed before the reload), so this is the same string the load is using.
for example "MoviesGrid", or "" when unknown
- Type:
- string
getBackdropMode() → {string}
Returns the backdrop mode for this presenter
"presentation" | "fullscreen" | "none"
- Type:
- string
getGridConfig(viewMode, _viewMode) → {object}
Returns grid layout configuration for the specified view mode
| Name | Type | Description |
|---|---|---|
viewMode | string | Current view mode
|
_viewMode | string |
Grid config with properties:
- Type:
- object
getOptions(parentItem, _parentItem) → {object}
Returns the options configuration for ItemGridOptions
| Name | Type | Description |
|---|---|---|
parentItem | object | The library item being displayed |
_parentItem | object |
Options object with views, sort, filter arrays
- Type:
- object
loadFilters(parentItem, itemType, forceopt) → {void}
Load dynamic filter options (Genres, Years, Ratings) from the Jellyfin API. Call from configureLoadTask() in subclasses that need dynamic filters. Delegates the fetch to the host component (BaseGridView.loadFilters) via callFunc so it runs in component-m context, where fetchAsync + auto-abandon work. A presenter is a class, not a component, so the auto-abandon plugin can't inject into it (Phase-4 collapse of GetFiltersTask; see docs/dev/promises.md). Results arrive via onFiltersLoaded(). Set by refreshFilters() when the panel opens.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
parentItem | object | The library item to load filters for | ||
itemType | string | The item type to filter (for example "Movie", "Series") | ||
force | boolean | <optional> | false | refetch even when this library is already cached. |
- Type:
- void
onDestroy() → {void}
Called when presenter is being destroyed Override to clean up resources, stop tasks, unobserve fields Always call super.onDestroy() at the end of overrides
- Type:
- void
onFiltersLoaded(filters, errorMsg) → {void}
Called when filters are delivered by the host component's promise (BaseGridView.loadFilters). Caches the result in m.apiFilters and shows a toast on failure.
| Name | Type | Description |
|---|---|---|
filters | object | The filter options AA (empty {} on failure) |
errorMsg | string | Non-empty on failure; triggers a toast |
- Type:
- void
onInit(view) → {void}
Called after presenter is attached to BaseGridView Stores the view reference; a subclass adds its own nodes (MoviePresenter's logo task) Override in subclass but call super.onInit(view) first
| Name | Type | Description |
|---|---|---|
view | object | Reference to BaseGridView component |
- Type:
- void
onItemFocused(item, currentView, _item, _currentView) → {void}
Called when an item receives focus Override to update presentation info display
| Name | Type | Description |
|---|---|---|
item | object | The focused ContentNode item |
currentView | string | The current view mode (for example "Movies", "MoviesGrid") |
_item | object | |
_currentView | string |
- Type:
- void
onOptionsClosed(options, _options) → {void}
Called when options dialog is closed Override to handle presenter-specific option changes
| Name | Type | Description |
|---|---|---|
options | object | The ItemGridOptions component |
_options | object |
- Type:
- void
refreshFilters() → {void}
refreshFilters: Revalidate the cached filter lists in the background.
Called when the options panel OPENS, which is the only moment the lists are actually looked at, so freshness is bought exactly where it is spent, and a session that never opens the panel pays for one load instead of one per query build.
Not rendered into the open panel, on purpose. BaseGridView.SetUpOptions() has already read m.apiFilters by the time this answers, and re-running it would reassign the panel's content and reset checkedItem: categories would appear and shift focus under a cursor already moving through the list. The refreshed lists show on the NEXT open, which is the stale-while-revalidate contract and the reason no TTL is needed.
It also retries a previous failure: a failed load never marks the cache populated, so the panel that needs those categories is what asks for them again.
- Type:
- void
(protected) serverVersion() → {string}
The connected server's version string, or "" when it cannot be read.
Presenters run on the render thread, where m.global is owned locally and free to touch (2.0 µs against 93 µs from a Task, measured 2026-08-23 on a Stick 4K; see docs/architecture/threading.md). The guards are for the unit suites, which construct a presenter against a stand-in view with no global at all, and textOrEmpty() rather than toString() because toString() falls through to Str() and FAULTS on Invalid.
for example "12.0.0", or "" when unknown
- Type:
- string
shouldShowPresentationInfo(viewMode, _viewMode) → {boolean}
Returns whether to show presentation info panel for the view mode
| Name | Type | Description |
|---|---|---|
viewMode | string | Current view mode |
_viewMode | string |
True to show info panel
- Type:
- boolean
showToast(message, toastTypeopt) → {void}
Show a toast notification via the scene-level Toast component. Safe to call from presenter classes (routes through view's scene reference).
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
message | string | The message to display | ||
toastType | string | <optional> | "error" | "error", "success", or "info" |
- Type:
- void
showsTVGuide(viewMode, _viewMode) → {boolean}
Returns whether the view mode is the TV Guide (EPG) instead of the item grid
| Name | Type | Description |
|---|---|---|
viewMode | string | Current view mode |
_viewMode | string |
True to show the TV Guide
- Type:
- boolean