Skip to content

Commit a53cb9a

Browse files
committed
Making sure initial tab load happens on turbo:load
1 parent c099d26 commit a53cb9a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

app/javascript/source_tabs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,7 @@ const initTabs = () => {
189189
// Initialize on page load and after Turbo navigates
190190
// turbo:load fires on both initial page load and subsequent Turbo navigations
191191
document.addEventListener('turbo:load', initTabs)
192+
193+
// Run immediately in case turbo:load already fired before this script loaded
194+
// (happens on first search when Turbo Drive loads the page containing this script)
195+
initTabs()

0 commit comments

Comments
 (0)