perf(sheet): cache plain-text item descriptions in item list rendering #128
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Athemis/ds4#128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Avoid repeated
htmlToPlainTextconversions during item list rendering. Each item row currently convertsitem.system.descriptionto 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:63callshtmlToPlainText item.system.descriptionfor the name field title.templates/sheets/actor/components/item-list-entry.hbs:72calls the same helper again for the description tooltip.src/handlebars/handlebars-helpers.ts:10tosrc/handlebars/handlebars-helpers.ts:12implementshtmlToPlainTextas$(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.