0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-13 13:55:12 +02:00
Epid 9cf7ea8a90 fix(stopwatch): show icon dynamically in tabs loaded before stopwatch starts
The stopwatch navbar icon and popup were only rendered by the server
when a stopwatch was already active at page load.  If a tab was opened
before the stopwatch started, `initStopwatch()` found no
`.active-stopwatch` element in the DOM, returned early, and never
registered a SharedWorker listener.  As a result the WebSocket push
from the stopwatch notifier had nowhere to land and the icon never
appeared.

Fix by always rendering both the icon anchor and the popup skeleton in
the navbar (hidden with `tw-hidden` when no stopwatch is active).
`initStopwatch()` can now set up the SharedWorker in every tab, and
`updateStopwatchData` can call `showElem`/`hideElem` as stopwatch state
changes arrive in real time.

Also add `onShow` to `createTippy` so the popup content is re-cloned
from the (JS-updated) original each time the tooltip opens, keeping
it current even when the stopwatch was started after page load.

Add a new e2e test (`stopwatch appears via real-time push`) that
verifies the icon appears after `apiStartStopwatch` is called with
the page already loaded.
2026-04-02 04:45:26 +03:00
..
2025-01-09 15:15:47 +08:00