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

fix(file-icons): initialise file icons once per page #209

Merged
pat-s merged 1 commit from fix/file-icons-init-once into v16.0/forgejo-codefloe 2026-10-01 14:59:53 +00:00
Owner

Closes #193.

initFileIcons() ran twice on every page: once from web_src/js/index.js and once from its own DOMContentLoaded listener in web_src/js/features/file-icons.js.
Each run cleared every [data-file-icon] element and created a new <img>, so the work was done twice.

  • Remove the self-registration from file-icons.js and keep the index.js call, which is how the other features initialise.
  • Update the comment in web_src/js/codefloe/index.js that pointed to file-icons.js as an example of self-registration.
  • Add a unit test that dispatches DOMContentLoaded and expects no icon to be inserted, then calls initFileIcons() and expects exactly one.
  • Add this PR to the Icons & UI row of the README custom changes table.

#192 (icons disappear after the last-commit morph) is not fixed here.

Closes #193. `initFileIcons()` ran twice on every page: once from `web_src/js/index.js` and once from its own `DOMContentLoaded` listener in `web_src/js/features/file-icons.js`. Each run cleared every `[data-file-icon]` element and created a new `<img>`, so the work was done twice. - Remove the self-registration from `file-icons.js` and keep the `index.js` call, which is how the other features initialise. - Update the comment in `web_src/js/codefloe/index.js` that pointed to `file-icons.js` as an example of self-registration. - Add a unit test that dispatches `DOMContentLoaded` and expects no icon to be inserted, then calls `initFileIcons()` and expects exactly one. - Add this PR to the `Icons & UI` row of the README custom changes table. #192 (icons disappear after the last-commit morph) is not fixed here.
pat-s force-pushed fix/file-icons-init-once from cd7395cf6a
Some checks failed
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (1/2) (pull_request) Has been cancelled
testing / test-e2e (2/2) (pull_request) Has been cancelled
testing / test-pgsql (1/4) (pull_request) Has been cancelled
testing / test-pgsql (2/4) (pull_request) Has been cancelled
testing / test-pgsql (3/4) (pull_request) Has been cancelled
testing / test-pgsql (4/4) (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Has been cancelled
testing / backend-checks (pull_request) Has been cancelled
to 4023f54409
All checks were successful
testing / backend-checks (pull_request) Successful in 4m16s
testing / test-unit (pull_request) Successful in 4m3s
testing / test-pgsql (2/4) (pull_request) Successful in 5m0s
testing / frontend-checks (pull_request) Successful in 2m45s
testing / test-pgsql (1/4) (pull_request) Successful in 6m58s
testing / test-pgsql (3/4) (pull_request) Successful in 8m57s
testing / test-e2e (1/2) (pull_request) Successful in 12m42s
testing / test-e2e (2/2) (pull_request) Successful in 13m5s
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 10m26s
2026-10-01 14:27:55 +00:00
Compare
pat-s scheduled this pull request to auto merge when all checks succeed 2026-10-01 14:37:46 +00:00
pat-s merged commit 6f1e48a2fc into v16.0/forgejo-codefloe 2026-10-01 14:59:53 +00:00
pat-s deleted branch fix/file-icons-init-once 2026-10-01 14:59:53 +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!209
No description provided.