mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-09 03:00:05 +02:00
fix(ui): relative time elements were reset on htmx swap (#7950)
Regression cf03286b5b
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7950
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>
This commit is contained in:
parent
3ae188652a
commit
0e8d752d86
2 changed files with 42 additions and 1 deletions
|
@ -141,4 +141,10 @@ function UpdateAllRelativeTimes() {
|
|||
for (const object of document.querySelectorAll('relative-time')) UpdateRelativeTime(object);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', UpdateAllRelativeTimes);
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
UpdateAllRelativeTimes();
|
||||
// Also update relative-time DOM elements after htmx swap events.
|
||||
document.body.addEventListener('htmx:afterSwap', () => {
|
||||
for (const object of document.querySelectorAll('relative-time')) DoUpdateRelativeTime(object);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue