Lints some errors and warnings (#76)

This commit is contained in:
Aryan Goharzad 2023-01-20 14:43:28 -05:00 committed by GitHub
parent 2fce1637b4
commit 06e41167d0
22 changed files with 62 additions and 38 deletions

View file

@ -48,12 +48,16 @@ export const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => {
setServiceDescription(undefined)
store.session.describeService(serviceUrl).then(
desc => {
if (aborted) return
if (aborted) {
return
}
setServiceDescription(desc)
setUserDomain(desc.availableUserDomains[0])
},
err => {
if (aborted) return
if (aborted) {
return
}
store.log.warn(
`Failed to fetch service description for ${serviceUrl}`,
err,

View file

@ -47,11 +47,15 @@ export const Signin = ({onPressBack}: {onPressBack: () => void}) => {
setError('')
store.session.describeService(serviceUrl).then(
desc => {
if (aborted) return
if (aborted) {
return
}
setServiceDescription(desc)
},
err => {
if (aborted) return
if (aborted) {
return
}
store.log.warn(
`Failed to fetch service description for ${serviceUrl}`,
err,

View file

@ -76,7 +76,7 @@ export function PostLoadingPlaceholder({
strokeWidth={1.7}
/>
</View>
<View style={s.flex1}></View>
<View style={s.flex1} />
</View>
</View>
</View>

View file

@ -40,11 +40,15 @@ export function UserInfoText({
let aborted = false
store.profiles.getProfile(did).then(
v => {
if (aborted) return
if (aborted) {
return
}
setProfile(v.data)
},
_err => {
if (aborted) return
if (aborted) {
return
}
setFailed(true)
},
)

View file

@ -36,7 +36,7 @@ export const ViewHeader = observer(function ViewHeader({
store.shell.setMainMenuOpen(true)
}
const onPressSearch = () => {
store.nav.navigate(`/search`)
store.nav.navigate('/search')
}
const onPressReconnect = () => {
store.session.connect().catch(e => {

View file

@ -88,11 +88,21 @@ export function SwipeAndZoom({
}
const canDir = (d: Dir) => {
if (d === Dir.Left) return canSwipeLeft
if (d === Dir.Right) return canSwipeRight
if (d === Dir.Up) return canSwipeUp
if (d === Dir.Down) return canSwipeDown
if (d === Dir.Zoom) return zoomEnabled
if (d === Dir.Left) {
return canSwipeLeft
}
if (d === Dir.Right) {
return canSwipeRight
}
if (d === Dir.Up) {
return canSwipeUp
}
if (d === Dir.Down) {
return canSwipeDown
}
if (d === Dir.Zoom) {
return zoomEnabled
}
return false
}
const isHorz = (d: Dir) => d === Dir.Left || d === Dir.Right

View file

@ -46,8 +46,11 @@ export function RichText({
</Text>
)
}
if (!style) style = []
else if (!Array.isArray(style)) style = [style]
if (!style) {
style = []
} else if (!Array.isArray(style)) {
style = [style]
}
entities.sort(sortByIndex)
const segments = Array.from(toSegments(text, entities))
const els = []

View file

@ -15,7 +15,7 @@ export const Contacts = ({navIdx, visible, params}: ScreenParams) => {
useEffect(() => {
if (visible) {
store.nav.setTitle(navIdx, `Contacts`)
store.nav.setTitle(navIdx, 'Contacts')
}
}, [store, visible])

View file

@ -40,7 +40,9 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
} else {
store.nav.setTitle(navIdx, params.name)
uiState.setup().then(() => {
if (aborted) return
if (aborted) {
return
}
setHasSetup(true)
})
}

View file

@ -33,7 +33,7 @@ export const Search = ({navIdx, visible, params}: ScreenParams) => {
if (visible) {
store.shell.setMinimalShellMode(false)
autocompleteView.setup()
store.nav.setTitle(navIdx, `Search`)
store.nav.setTitle(navIdx, 'Search')
}
}, [store, visible, name])