fix(file-icons): fill icons again after the last-commit loader morph #216
No reviewers
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/forgejo-codefloe!216
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/file-icons-after-morph"
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?
Closes #192.
When a directory's commit info takes over a second, the file table loads it afterwards with
hx-swap="morph"(templates/repo/view_list.tmpl:2).The loader response has empty
<span data-file-icon>elements, so the morph removed the iconsinitFileIcons()had inserted, and nothing filled them again.With the default
deviconset, every file icon disappeared on large or slow directories once the commit messages arrived.initFileIcons()intofillFileIcons(root), which also handles a root that is itself an icon span.htmx:afterSettlelistener ininitFileIcons()that fills the icons again, only inside the swapped element (event.detail.elt).htmx:afterSettleon the table, and expects only the table's icon to be filled again.tests/e2e/file-icons.test.e2e.ts, which injects the loader attributes into/user2/repo1asuser1(devicon), waits for the morph, and expects every icon span in the table to hold an icon.Icons & UIrow of the README custom changes table.Both tests fail without the listener and pass with it; the e2e test passes on chromium, firefox and Mobile Chrome.