codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

fix(file-icons): fill icons again after the last-commit loader morph #216

Merged
pat-s merged 1 commit from fix/file-icons-after-morph into v16.0/forgejo-codefloe 2026-10-02 09:57:00 +00:00
Owner

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 icons initFileIcons() had inserted, and nothing filled them again.
With the default devicon set, every file icon disappeared on large or slow directories once the commit messages arrived.

  • Split the fill loop out of initFileIcons() into fillFileIcons(root), which also handles a root that is itself an icon span.
  • Register an htmx:afterSettle listener in initFileIcons() that fills the icons again, only inside the swapped element (event.detail.elt).
  • Add a unit test that empties icons inside and outside a swapped table, fires htmx:afterSettle on the table, and expects only the table's icon to be filled again.
  • Add the e2e test tests/e2e/file-icons.test.e2e.ts, which injects the loader attributes into /user2/repo1 as user1 (devicon), waits for the morph, and expects every icon span in the table to hold an icon.
  • Add this PR to the Icons & UI row 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.

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 icons `initFileIcons()` had inserted, and nothing filled them again. With the default `devicon` set, every file icon disappeared on large or slow directories once the commit messages arrived. - Split the fill loop out of `initFileIcons()` into `fillFileIcons(root)`, which also handles a root that is itself an icon span. - Register an `htmx:afterSettle` listener in `initFileIcons()` that fills the icons again, only inside the swapped element (`event.detail.elt`). - Add a unit test that empties icons inside and outside a swapped table, fires `htmx:afterSettle` on the table, and expects only the table's icon to be filled again. - Add the e2e test `tests/e2e/file-icons.test.e2e.ts`, which injects the loader attributes into `/user2/repo1` as `user1` (`devicon`), waits for the morph, and expects every icon span in the table to hold an icon. - Add this PR to the `Icons & UI` row 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.
fix(file-icons): fill icons again after the last-commit loader morph
All checks were successful
testing / frontend-checks (pull_request) Successful in 2m50s
testing / test-e2e (2/2) (pull_request) Successful in 1m17s
testing / test-pgsql (3/4) (pull_request) Successful in 10m5s
testing / backend-checks (pull_request) Successful in 4m27s
testing / test-unit (pull_request) Successful in 6m36s
testing / test-pgsql (1/4) (pull_request) Successful in 8m15s
testing / test-e2e (1/2) (pull_request) Successful in 1m13s
testing / test-pgsql (2/4) (pull_request) Successful in 5m33s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
testing / test-pgsql (4/4) (pull_request) Successful in 8m35s
8dfea5320e
Closes #192.

- Split the fill loop out of initFileIcons() into fillFileIcons(root).
- Fill icons again inside the swapped element on htmx:afterSettle, so the
  last-commit loader morph on #repo-files-table no longer leaves them empty.
- Add a unit test and an e2e test that reproduces the morph on /user2/repo1.
- Add this PR to the Icons & UI row of the README custom changes table.
pat-s scheduled this pull request to auto merge when all checks succeed 2026-10-02 09:29:39 +00:00
pat-s merged commit 7b200bd4d5 into v16.0/forgejo-codefloe 2026-10-02 09:57:00 +00:00
pat-s deleted branch fix/file-icons-after-morph 2026-10-02 09:57:00 +00:00
Sign in to join this conversation.
No reviewers
No milestone
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
codefloe/forgejo-codefloe!216
No description provided.