perf(sheet): cache plain-text item descriptions in item list rendering #128

Closed
opened 2026-03-15 18:52:02 +00:00 by Athemis · 0 comments
Owner

Description

Avoid repeated htmlToPlainText conversions during item list rendering. Each item row currently converts item.system.description to plain text twice for tooltip/title rendering, and the helper implementation uses jQuery HTML parsing. On large inventories this adds repeated parsing work on top of the already enriched HTML descriptions.

A follow-up should either cache the plain-text value per item render or render it once and reuse it where needed.

Context

Evidence:

  • templates/sheets/actor/components/item-list-entry.hbs:63 calls htmlToPlainText item.system.description for the name field title.
  • templates/sheets/actor/components/item-list-entry.hbs:72 calls the same helper again for the description tooltip.
  • src/handlebars/handlebars-helpers.ts:10 to src/handlebars/handlebars-helpers.ts:12 implements htmlToPlainText as $(input).text(), which reparses the HTML string each time.

This is a smaller hotspot than the inventory-context rebuild, but it sits inside every rendered item row.

### Description Avoid repeated `htmlToPlainText` conversions during item list rendering. Each item row currently converts `item.system.description` to plain text twice for tooltip/title rendering, and the helper implementation uses jQuery HTML parsing. On large inventories this adds repeated parsing work on top of the already enriched HTML descriptions. A follow-up should either cache the plain-text value per item render or render it once and reuse it where needed. ### Context Evidence: - `templates/sheets/actor/components/item-list-entry.hbs:63` calls `htmlToPlainText item.system.description` for the name field title. - `templates/sheets/actor/components/item-list-entry.hbs:72` calls the same helper again for the description tooltip. - `src/handlebars/handlebars-helpers.ts:10` to `src/handlebars/handlebars-helpers.ts:12` implements `htmlToPlainText` as `$(input).text()`, which reparses the HTML string each time. This is a smaller hotspot than the inventory-context rebuild, but it sits inside every rendered item row.
Athemis self-assigned this 2026-03-15 20:18:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Athemis/ds4#128
No description provided.