A platform for community discussion. Free, open, simple.
FIX: Restore stream position in safari (#9993)
Penar Musarajbdba17cdf79f
diff --git a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.jsindex cb9b3dac27a..399e2a7e63b 100644--- a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js+++ b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js@@ -333,6 +333,13 @@ export default MountWidget.extend({});this.appEvents.on("post-stream:refresh", this, "_refresh");++ // restore scroll position on browsers with aggressive BFCaches (like Safari)+ window.onpageshow = function(event) {+ if (event.persisted) {+ DiscourseURL.routeTo(this.location.pathname);+ }+ };},willDestroyElement() {