Turbo.visit with target frame reloads entire page


I have a pretty simple case in which i want to manually trigger frame content refresh. Frame is not loaded lazily, it just wraps part of the page. It’s id is id="shipment_label_15".

To reload just contents of this frame, I’m calling Turbo.visit(document.location, { frame: 'shipment_label_15' }) however, instead of frame content being reloaded, entire page gets reloaded. Am i doing something wrong in here or am I misunterstanding some concepts around reloading frames?

Thanks in advance for any clues.

I believe that what you’re experiencing is the old, confusing behavior of a missing frame error. Are you using a version of Turbo prior to 7.3 (turbo-rails v1.4)? Since v7.3.0, Turbo will replace the frame with the text “content missing,” which would have been much more helpful to you… Anyway, I believe the source of your problem is that document.location returns an object, not a string. Try document.location.pathname instead.