Hotwire Discussion

Reload turbo-frame on window focus

I have a turbo-frame that loads a timer for a given page — all works normally if the page is in focus but in many situations, mobile, tab/window in background, etc. the timer can get paused causing drift.

I’m thinking I could use data-action="focus@window->timer#reload" (The timer already has a stimulus controller) to call a function that would cause the frame to reload — I’m wondering what the best way to poke the turbo-frame to reload would would be?

Hi, didn’t use it, but may be FrameElement.reload() ?