Skip to content

Commit

Permalink
fix some null exceptions in get()
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Apr 19, 2018
1 parent 7457521 commit c9c1959
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions routes/_components/compose/ComposeAutosuggest.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
// perf improves for input responsiveness
this.observe('composeSelectionStart', () => {
scheduleIdleTask(() => {
let { composeSelectionStart } = this.get()
let { composeSelectionStart } = this.get() || {} // TODO: wtf svelte?
this.set({composeSelectionStartDeferred: composeSelectionStart})
})
})
this.observe('composeFocused', (composeFocused) => {
let updateFocusedState = () => {
scheduleIdleTask(() => {
let { composeFocused } = this.get()
let { composeFocused } = this.get() || {} // TODO: wtf svelte?
this.set({composeFocusedDeferred: composeFocused})
})
}
Expand Down
2 changes: 1 addition & 1 deletion routes/_components/compose/ComposeLengthGauge.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
this.observe('lengthAsFraction', () => {
scheduleIdleTask(() => {
mark('set lengthAsFractionDeferred')
let { lengthAsFraction } = this.get()
let { lengthAsFraction } = this.get() || {} // TODO: wtf svelte?
this.set({lengthAsFractionDeferred: lengthAsFraction})
stop('set lengthAsFractionDeferred')
requestAnimationFrame(() => this.set({shouldAnimate: true}))
Expand Down
2 changes: 1 addition & 1 deletion routes/_components/compose/ComposeLengthIndicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
this.observe('lengthToDisplay', () => {
scheduleIdleTask(() => {
mark('set lengthToDisplayDeferred')
let { lengthToDisplay } = this.get()
let { lengthToDisplay } = this.get() || {} // TODO: wtf svelte?
this.set({lengthToDisplayDeferred: lengthToDisplay})
stop('set lengthToDisplayDeferred')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@
await setAccountFollowed(accountId, !following, true)
},
async onBlockClicked() {
let { account, blocking } = this.get()
let accountId = account.id
let { accountId, blocking } = this.get()
this.close()
await setAccountBlocked(accountId, !blocking, true)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{{/if}}
</div>
<script>

import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import { mark, stop } from '../../_utils/marks'

Expand All @@ -27,7 +26,7 @@
// unrender lazily; it's not a critical UI task
scheduleIdleTask(() => {
mark('unrender')
let { isIntersecting } = this.get()
let { isIntersecting } = this.get() || {} // TODO: wtf svelte?
if (!isIntersecting) {
this.set({hide: true})
}
Expand Down
10 changes: 6 additions & 4 deletions routes/_components/status/Media.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@
},
methods: {
async onClickPlayVideoButton() {
let { media, width, height } = this.get()
let { media, modalWidth, modalHeight } = this.get()
let dialogs = await importDialogs()
dialogs.showVideoDialog(media.preview_url, media.url, width, height, media.description)
dialogs.showVideoDialog(media.preview_url, media.url,
modalWidth, modalHeight, media.description)
},
async onClickShowImageButton() {
let { media, width, height } = this.get()
let { media, modalWidth, modalHeight } = this.get()
let dialogs = await importDialogs()
dialogs.showImageDialog(media.preview_url, media.url, media.type, width, height, media.description)
dialogs.showImageDialog(media.preview_url, media.url, media.type,
modalWidth, modalHeight, media.description)
}
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion routes/_components/timeline/Timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h1 class="sr-only">{{label}}</h1>
let { currentInstance } = this.store.get()
let { timeline } = this.get()
let handleItemIdsToAdd = () => {
let { itemIdsToAdd } = this.get()
let { itemIdsToAdd } = this.get() || {} // TODO: wtf svelte?
if (!itemIdsToAdd || !itemIdsToAdd.length) {
return
}
Expand Down
3 changes: 2 additions & 1 deletion routes/_pages/accounts/[accountId].html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ <h1>Profile</h1>

export default {
oncreate() {
let { accountId } = this.get().accountId
let { params } = this.get()
let { accountId } = params
clearProfileAndRelationship()
updateProfileAndRelationship(accountId)
},
Expand Down

0 comments on commit c9c1959

Please sign in to comment.