From c3a82a15bf191e543a0d9fa8a523993134d84c19 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Feb 2018 14:17:17 -0800 Subject: [PATCH] Revert "add observeSafely()" it doesn't actually work This reverts commit 321a90251a9ad8754f12da1579b54b88e60ee98c. --- .../_components/virtualList/VirtualList.html | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/routes/_components/virtualList/VirtualList.html b/routes/_components/virtualList/VirtualList.html index d5833e9b..66914561 100644 --- a/routes/_components/virtualList/VirtualList.html +++ b/routes/_components/virtualList/VirtualList.html @@ -32,10 +32,10 @@ export default { oncreate () { - this.observeSafely('showFooter', showFooter => { + this.observe('showFooter', showFooter => { this.store.setForRealm({showFooter: showFooter}) }) - this.observeSafely('items', (items) => { + this.observe('items', (items) => { mark('set items') this.store.setForRealm({items: items}) stop('set items') @@ -44,7 +44,7 @@ }, SCROLL_TO_BOTTOM_DELAY) }) - this.observeSafely('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => { + this.observe('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => { if (allVisibleItemsHaveHeight) { this.fire('initializedVisibleItems') } @@ -52,7 +52,7 @@ let observedOnce = false - this.observeSafely('distanceFromBottom', (distanceFromBottom) => { + this.observe('distanceFromBottom', (distanceFromBottom) => { if (!observedOnce) { observedOnce = true // TODO: the first time is always 0... need better way to handle this return @@ -77,19 +77,6 @@ }, // TODO: bug in svelte store, shouldn't need to do this allVisibleItemsHaveHeight: ($allVisibleItemsHaveHeight) => $allVisibleItemsHaveHeight - }, - ondestroy() { - this.__destroyed = true - }, - methods: { - observeSafely(val, callback) { - // TODO: feels like this shouldn't be necessary... bug in Svelte? - this.observe(val, val => { - if (!this.__destroyed) { - callback(val) - } - }) - } } } \ No newline at end of file