fix(file-icons): initialise file icons once per page #209
No reviewers
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/forgejo-codefloe!209
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/file-icons-init-once"
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 #193.
initFileIcons()ran twice on every page: once fromweb_src/js/index.jsand once from its ownDOMContentLoadedlistener inweb_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.file-icons.jsand keep theindex.jscall, which is how the other features initialise.web_src/js/codefloe/index.jsthat pointed tofile-icons.jsas an example of self-registration.DOMContentLoadedand expects no icon to be inserted, then callsinitFileIcons()and expects exactly one.Icons & UIrow of the README custom changes table.#192 (icons disappear after the last-commit morph) is not fixed here.
cd7395cf6a4023f54409