From 1151a3be4ba0e2678883489067f2a112a978046f Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 21 Apr 2018 09:56:45 -0700 Subject: [PATCH] fix null in Timeline.html get() (#205) --- .../_components/compose/ComposeAutosuggest.html | 4 ++-- .../_components/compose/ComposeLengthGauge.html | 2 +- .../compose/ComposeLengthIndicator.html | 2 +- .../pseudoVirtualList/PseudoVirtualListItem.html | 2 +- routes/_components/timeline/Timeline.html | 15 +++++++-------- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/routes/_components/compose/ComposeAutosuggest.html b/routes/_components/compose/ComposeAutosuggest.html index 78dc03db..6d42a909 100644 --- a/routes/_components/compose/ComposeAutosuggest.html +++ b/routes/_components/compose/ComposeAutosuggest.html @@ -59,14 +59,14 @@ // perf improves for input responsiveness this.observe('composeSelectionStart', () => { scheduleIdleTask(() => { - let { composeSelectionStart } = this.get() || {} // TODO: wtf svelte? + let { composeSelectionStart } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354 this.set({composeSelectionStartDeferred: composeSelectionStart}) }) }) this.observe('composeFocused', (composeFocused) => { let updateFocusedState = () => { scheduleIdleTask(() => { - let { composeFocused } = this.get() || {} // TODO: wtf svelte? + let { composeFocused } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354 this.set({composeFocusedDeferred: composeFocused}) }) } diff --git a/routes/_components/compose/ComposeLengthGauge.html b/routes/_components/compose/ComposeLengthGauge.html index d187e1e5..5408b87f 100644 --- a/routes/_components/compose/ComposeLengthGauge.html +++ b/routes/_components/compose/ComposeLengthGauge.html @@ -31,7 +31,7 @@ this.observe('lengthAsFraction', () => { scheduleIdleTask(() => { mark('set lengthAsFractionDeferred') - let { lengthAsFraction } = this.get() || {} // TODO: wtf svelte? + let { lengthAsFraction } = this.get() || {} // https://github.com/sveltejs/svelte/issues/1354 this.set({lengthAsFractionDeferred: lengthAsFraction}) stop('set lengthAsFractionDeferred') requestAnimationFrame(() => this.set({shouldAnimate: true})) diff --git a/routes/_components/compose/ComposeLengthIndicator.html b/routes/_components/compose/ComposeLengthIndicator.html index 9b054ccf..d09afb6c 100644 --- a/routes/_components/compose/ComposeLengthIndicator.html +++ b/routes/_components/compose/ComposeLengthIndicator.html @@ -29,7 +29,7 @@ this.observe('lengthToDisplay', () => { scheduleIdleTask(() => { mark('set lengthToDisplayDeferred') - let { lengthToDisplay } = this.get() || {} // TODO: wtf svelte? + let { lengthToDisplay } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354 this.set({lengthToDisplayDeferred: lengthToDisplay}) stop('set lengthToDisplayDeferred') }) diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html index 5e0f9773..15dcc832 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html @@ -26,7 +26,7 @@ // unrender lazily; it's not a critical UI task scheduleIdleTask(() => { mark('unrender') - let { isIntersecting } = this.get() || {} // TODO: wtf svelte? + let { isIntersecting } = this.get() || {} // https://github.com/sveltejs/svelte/issues/1354 if (!isIntersecting) { this.set({hide: true}) } diff --git a/routes/_components/timeline/Timeline.html b/routes/_components/timeline/Timeline.html index e87244a6..8d1a44d1 100644 --- a/routes/_components/timeline/Timeline.html +++ b/routes/_components/timeline/Timeline.html @@ -166,13 +166,12 @@ this.set({scrollTop: scrollTop}) }, onScrollToBottom () { - let { - timelineInitialized, - runningUpdate - } = this.store.get() - let { - timelineType - } = this.get() + let state = this.store.get() + if (!state) { + return // https://github.com/sveltejs/svelte/issues/1354 + } + let { timelineType } = state + let { timelineInitialized, runningUpdate } = this.store.get() if (!timelineInitialized || runningUpdate || timelineType === 'status') { // for status contexts, we've already fetched the whole thread @@ -198,7 +197,7 @@ let { currentInstance } = this.store.get() let { timeline } = this.get() let handleItemIdsToAdd = () => { - let { itemIdsToAdd } = this.get() || {} // TODO: wtf svelte? + let { itemIdsToAdd } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354 if (!itemIdsToAdd || !itemIdsToAdd.length) { return }