fix null in Timeline.html get() (#205)

This commit is contained in:
Nolan Lawson 2018-04-21 09:56:45 -07:00 committed by GitHub
parent 78f44c7b51
commit 1151a3be4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 13 deletions

View file

@ -59,14 +59,14 @@
// perf improves for input responsiveness // perf improves for input responsiveness
this.observe('composeSelectionStart', () => { this.observe('composeSelectionStart', () => {
scheduleIdleTask(() => { scheduleIdleTask(() => {
let { composeSelectionStart } = this.get() || {} // TODO: wtf svelte? let { composeSelectionStart } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354
this.set({composeSelectionStartDeferred: composeSelectionStart}) this.set({composeSelectionStartDeferred: composeSelectionStart})
}) })
}) })
this.observe('composeFocused', (composeFocused) => { this.observe('composeFocused', (composeFocused) => {
let updateFocusedState = () => { let updateFocusedState = () => {
scheduleIdleTask(() => { scheduleIdleTask(() => {
let { composeFocused } = this.get() || {} // TODO: wtf svelte? let { composeFocused } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354
this.set({composeFocusedDeferred: composeFocused}) this.set({composeFocusedDeferred: composeFocused})
}) })
} }

View file

@ -31,7 +31,7 @@
this.observe('lengthAsFraction', () => { this.observe('lengthAsFraction', () => {
scheduleIdleTask(() => { scheduleIdleTask(() => {
mark('set lengthAsFractionDeferred') 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}) this.set({lengthAsFractionDeferred: lengthAsFraction})
stop('set lengthAsFractionDeferred') stop('set lengthAsFractionDeferred')
requestAnimationFrame(() => this.set({shouldAnimate: true})) requestAnimationFrame(() => this.set({shouldAnimate: true}))

View file

@ -29,7 +29,7 @@
this.observe('lengthToDisplay', () => { this.observe('lengthToDisplay', () => {
scheduleIdleTask(() => { scheduleIdleTask(() => {
mark('set lengthToDisplayDeferred') 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}) this.set({lengthToDisplayDeferred: lengthToDisplay})
stop('set lengthToDisplayDeferred') stop('set lengthToDisplayDeferred')
}) })

View file

@ -26,7 +26,7 @@
// unrender lazily; it's not a critical UI task // unrender lazily; it's not a critical UI task
scheduleIdleTask(() => { scheduleIdleTask(() => {
mark('unrender') mark('unrender')
let { isIntersecting } = this.get() || {} // TODO: wtf svelte? let { isIntersecting } = this.get() || {} // https://github.com/sveltejs/svelte/issues/1354
if (!isIntersecting) { if (!isIntersecting) {
this.set({hide: true}) this.set({hide: true})
} }

View file

@ -166,13 +166,12 @@
this.set({scrollTop: scrollTop}) this.set({scrollTop: scrollTop})
}, },
onScrollToBottom () { onScrollToBottom () {
let { let state = this.store.get()
timelineInitialized, if (!state) {
runningUpdate return // https://github.com/sveltejs/svelte/issues/1354
} = this.store.get() }
let { let { timelineType } = state
timelineType let { timelineInitialized, runningUpdate } = this.store.get()
} = this.get()
if (!timelineInitialized || if (!timelineInitialized ||
runningUpdate || runningUpdate ||
timelineType === 'status') { // for status contexts, we've already fetched the whole thread timelineType === 'status') { // for status contexts, we've already fetched the whole thread
@ -198,7 +197,7 @@
let { currentInstance } = this.store.get() let { currentInstance } = this.store.get()
let { timeline } = this.get() let { timeline } = this.get()
let handleItemIdsToAdd = () => { let handleItemIdsToAdd = () => {
let { itemIdsToAdd } = this.get() || {} // TODO: wtf svelte? let { itemIdsToAdd } = this.get() || {} // // https://github.com/sveltejs/svelte/issues/1354
if (!itemIdsToAdd || !itemIdsToAdd.length) { if (!itemIdsToAdd || !itemIdsToAdd.length) {
return return
} }