Skip to content

Commit

Permalink
Clear turbo cache before visiting to avoid unwanted snapshot restorat…
Browse files Browse the repository at this point in the history
…ion (#53)
  • Loading branch information
Intrepidd authored Mar 25, 2024
1 parent b7628b9 commit 57db695
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/hotwire-livereload-turbo-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
} else {
console.log("[Hotwire::Livereload] Files changed. Reloading..");
hotwire_livereload_scroll_position_default.save();
Turbo.cache.clear();
Turbo.visit(window.location.href, { action: "replace" });
}
}, 300);
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/hotwire-livereload.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@
} else {
console.log("[Hotwire::Livereload] Files changed. Reloading..");
hotwire_livereload_scroll_position_default.save();
Turbo.cache.clear();
Turbo.visit(window.location.href, { action: "replace" });
}
}, 300);
Expand Down
1 change: 1 addition & 0 deletions app/javascript/lib/hotwire-livereload-received.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default debounce(({force_reload}) => {
} else {
console.log("[Hotwire::Livereload] Files changed. Reloading..")
scrollPosition.save()
Turbo.cache.clear()
Turbo.visit(window.location.href, { action: 'replace' })
}
}, 300)

0 comments on commit 57db695

Please sign in to comment.