homeRowFailure

Decision layer for a Home row whose load failed: what the row shows, and when it goes back to loading. HomeRows applies these; they live in source/ so a Rooibos suite can reach them without a callFunc seam on the component (same move as source/home/latestRows.bs).

The rule, for every Home section: a failed load says nothing about what the section holds, so it never removes or empties a row (decision home-row-failure-tile). A row that already shows items keeps them. A row still waiting on its first load stops spinning and shows a "couldn't load" tile, so a failure does not read as loading forever; pressing OK on it retries (HomeRows.itemSelected). A section with no row on screen stays off it.

Members

(static, constant) PLACEHOLDER_FAILED

The row shows the failed placeholder (the "couldn't load" tile).

Default Value
  • failed

(static, constant) PLACEHOLDER_LOADING

The row shows the loading placeholder (a spinner).

Default Value
  • loading

Methods

(static) afterFailure(state) → {string}

The placeholder a row switches to when its section's load fails, or "" to leave the row as it is. Only a row still loading changes: items stay, and a failed tile already says so.

Parameters:
NameTypeDescription
statestring

the row's placeholderState

Returns:

PLACEHOLDER_FAILED or ""

Type: 
string

(static) afterRetry(state) → {string}

The placeholder a row switches to when its section's load starts again, or "" to leave the row as it is. A failed tile goes back to the spinner, so a retry shows it is under way; a row with items keeps them until the new answer replaces them.

Parameters:
NameTypeDescription
statestring

the row's placeholderState

Returns:

PLACEHOLDER_LOADING or ""

Type: 
string

(static) isAnswered(status) → {boolean}

Whether a section's result may act on its row: only an answered load says what the section holds. Anything else ("failed", or a task that set no status) must not.

Parameters:
NameTypeDescription
statusdynamic

the load's status field ("ok" / "failed" / "")

Returns:

true only for "ok"

Type: 
boolean

(static) needsFavoritesStandIn(rowStates, hasStandIn) → {boolean}

Whether a failed Favorites items load (/Items, every row but People) needs the one "Favorites" stand-in row. On a first load each of those types has a spinning skeleton row, and a failed tile on every one would stack up to fifteen identical messages; they are replaced by one row that says the same thing once. A stand-in already there (a retry that failed again) goes back to its failed tile. After an answered load no row of those types is loading (each was filled or removed), so a later failure changes nothing and the rows keep their items.

Parameters:
NameTypeDescription
rowStatesobject

placeholderState of each on-screen row the items load fills

hasStandInboolean

whether the stand-in row is on screen

Returns:

true when the stand-in should show the failed tile

Type: 
boolean

(static) needsLatestMediaStandIn(sectionPlan, hasLibraryRow) → {boolean}

Whether a failed FIRST libraries load needs a stand-in row where the latest-media rows would go. Those rows come from the libraries answer, so a failed one leaves none; with a My Media row on screen its failed tile already says the libraries did not load, and a second tile for the same request would only repeat it. Without one, the stand-in is the only place the failure shows.

Parameters:
NameTypeDescription
sectionPlandynamic

HomeRows' plan, [{ type }] in layout order

hasLibraryRowboolean

whether the My Media row is on screen

Returns:

true when the layout shows latest media and has no My Media row

Type: 
boolean

(static) noteResult(list, sectionId, status) → {void}

RTA builds only: record a section's latest load result on list's rtaSectionResults ({: { status, count } }), adding the field on first use, so a spec can wait for a load to finish even when, having failed, it changes nothing on screen (tests/rta/lib/steps.js readHomeRows). Nothing reads it in the app; release builds compile it to nothing.

Parameters:
NameTypeDescription
listobject

the row list node (HomeRows or FavoritesRows)

sectionIdstring

the section the load was for

statusdynamic

the load's status

Returns:
Type: 
void

(static) placeholderState(row) → {string}

Which placeholder row shows, or "" when it shows items or is absent.

A placeholder is only ever a row's sole child: createSkeletonRow and insertLatestMediaSkeletons give a new row exactly one, and populateRowFromData replaces all of a row's children when items land.

Parameters:
NameTypeDescription
rowdynamic

a HomeRow node, or invalid

Returns:

PLACEHOLDER_LOADING, PLACEHOLDER_FAILED, or ""

Type: 
string