chore: remove blocks from arrow functions where not needed
This commit is contained in:
parent
5e848a6c40
commit
1272ed9e39
6 changed files with 23 additions and 29 deletions
|
|
@ -6,9 +6,7 @@ export function debounce<F extends (...args: any[]) => any>(
|
|||
return (...args: Parameters<F>) =>
|
||||
new Promise(rs => {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
rs(func(...args))
|
||||
}, timeout)
|
||||
timer = setTimeout(() => rs(func(...args)), timeout)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@ const ErrorTypeWhitelist = [ReferenceError, TypeError, RangeError]
|
|||
Promise._m = (promise, err) => {
|
||||
if (err)
|
||||
setTimeout(
|
||||
() => {
|
||||
if (promise._h === 0)
|
||||
logger.error(
|
||||
`Unhandled promise rejection: ${getErrorStack(err)}`,
|
||||
)
|
||||
},
|
||||
() =>
|
||||
promise._h === 0 &&
|
||||
logger.error(
|
||||
`Unhandled promise rejection: ${getErrorStack(err)}`,
|
||||
),
|
||||
ErrorTypeWhitelist.some(it => err instanceof it) ? 0 : 2000,
|
||||
// The time is completely arbitary. I've picked what Hermes chose.
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ const RDTConnectSetting: SettingsItem = {
|
|||
parent: Setting.RevengeDeveloper,
|
||||
IconComponent: () => <TableRowAssetIcon name="LinkIcon" />,
|
||||
title: () => 'Connect to React DevTools',
|
||||
usePredicate: () => {
|
||||
const dtOpen = useIsConnected()
|
||||
return RDTContext.active && !dtOpen
|
||||
},
|
||||
usePredicate: () => useIsConnected() && RDTContext.active,
|
||||
onPress: connect,
|
||||
type: 'pressable',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,21 +54,21 @@ export function RDTAddrSetting() {
|
|||
isDisabled={open}
|
||||
label="React DevTools"
|
||||
leadingText="ws://"
|
||||
onBlur={() => {
|
||||
onBlur={() =>
|
||||
api.storage
|
||||
.set({
|
||||
devtools: {
|
||||
address: RDTContext.addr,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
.then(() =>
|
||||
ToastActionCreators.open({
|
||||
IconComponent: CircleCheckIcon,
|
||||
key: 'REACT_DEVTOOLS_ADDRESS_SAVED',
|
||||
content: 'Address saved',
|
||||
})
|
||||
})
|
||||
}}
|
||||
}),
|
||||
)
|
||||
}
|
||||
onChange={text => (RDTContext.addr = text)}
|
||||
returnKeyType="done"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -49,15 +49,17 @@ export function InstalledPluginCard({
|
|||
const enabled = Boolean(flags & PluginFlags.Enabled)
|
||||
const styles_ = usePluginCardStyles()
|
||||
|
||||
const settingsRef = useClickOutside<View>(() => {
|
||||
if (enableTooltipTarget.current === settingsRef.current)
|
||||
setEnablePluginTooltipVisible?.(false)
|
||||
})
|
||||
const settingsRef = useClickOutside<View>(
|
||||
() =>
|
||||
enableTooltipTarget.current === settingsRef.current &&
|
||||
setEnablePluginTooltipVisible?.(false),
|
||||
)
|
||||
|
||||
const switchRef = useClickOutside<View>(() => {
|
||||
if (essentialTooltipTarget.current === switchRef.current)
|
||||
setEssentialPluginTooltipVisible?.(false)
|
||||
})
|
||||
const switchRef = useClickOutside<View>(
|
||||
() =>
|
||||
essentialTooltipTarget.current === switchRef.current &&
|
||||
setEssentialPluginTooltipVisible?.(false),
|
||||
)
|
||||
|
||||
return (
|
||||
<Card style={[styles_.card, styles.grow, rightGap && styles_.rightGap]}>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ export default function RevengeCustomPageScreen({
|
|||
const { render: PageComponent, options } = route.params
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: We only want to set options once
|
||||
useLayoutEffect(() => {
|
||||
if (options) navigation.setOptions(options)
|
||||
}, [])
|
||||
useLayoutEffect(() => options && navigation.setOptions(options), [])
|
||||
|
||||
return <PageComponent />
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue