From e7e9c99568cd3330d035b7a56f8cd723353e73e1 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 13 Sep 2024 19:19:40 +0100 Subject: [PATCH] DEV: Drop ScrollTracker component (#28911) Restoring scroll position is now handled by the route-scroll-manager service, so this is unneeded --- .../app/components/scroll-tracker.js | 40 ------------------- .../app/templates/full-page-search.hbs | 6 --- ...dmin-plugins-discourse-automation-edit.hbs | 2 - 3 files changed, 48 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/components/scroll-tracker.js diff --git a/app/assets/javascripts/discourse/app/components/scroll-tracker.js b/app/assets/javascripts/discourse/app/components/scroll-tracker.js deleted file mode 100644 index 317f61b0864..00000000000 --- a/app/assets/javascripts/discourse/app/components/scroll-tracker.js +++ /dev/null @@ -1,40 +0,0 @@ -import Component from "@ember/component"; -import { next } from "@ember/runloop"; -import $ from "jquery"; -import Scrolling from "discourse/mixins/scrolling"; - -export default class ScrollTracker extends Component.extend(Scrolling) { - didReceiveAttrs() { - super.didReceiveAttrs(...arguments); - - this.set("trackerName", `scroll-tracker-${this.name}`); - } - - didInsertElement() { - super.didInsertElement(...arguments); - - this.bindScrolling(); - } - - didRender() { - super.didRender(...arguments); - - const data = this.session.get(this.trackerName); - if (data && data.position >= 0 && data.tag === this.tag) { - next(() => $(window).scrollTop(data.position + 1)); - } - } - - willDestroyElement() { - super.willDestroyElement(...arguments); - - this.unbindScrolling(); - } - - scrolled() { - this.session.set(this.trackerName, { - position: $(window).scrollTop(), - tag: this.tag, - }); - } -} diff --git a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs b/app/assets/javascripts/discourse/app/templates/full-page-search.hbs index 23df58a75f3..1d535097693 100644 --- a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs +++ b/app/assets/javascripts/discourse/app/templates/full-page-search.hbs @@ -5,12 +5,6 @@ {{body-class "search-page"}}
-