Skip to content

Commit 8f8c5d5

Browse files
ci: apply automated fixes
1 parent e0b5eed commit 8f8c5d5

File tree

6 files changed

+62
-55
lines changed

6 files changed

+62
-55
lines changed

examples/react-native/shopping-list/app/_layout.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ import { Stack } from 'expo-router'
66
import { QueryClientProvider } from '@tanstack/react-query'
77
import { SafeAreaProvider } from 'react-native-safe-area-context'
88
import { StatusBar } from 'expo-status-bar'
9-
import { Alert, Modal, Platform, Pressable, StyleSheet, Text, View } from 'react-native'
9+
import {
10+
Alert,
11+
Modal,
12+
Platform,
13+
Pressable,
14+
StyleSheet,
15+
Text,
16+
View,
17+
} from 'react-native'
1018
import { queryClient } from '../src/utils/queryClient'
1119
import { ShoppingProvider, useShopping } from '../src/db/ShoppingContext'
1220

@@ -103,7 +111,9 @@ function HeaderControls({ onAppRefresh }: { onAppRefresh: () => void }) {
103111
}}
104112
accessibilityLabel="Open demo menu"
105113
>
106-
<Text style={{ fontSize: 16, fontWeight: `700`, color: `#111827` }}></Text>
114+
<Text style={{ fontSize: 16, fontWeight: `700`, color: `#111827` }}>
115+
116+
</Text>
107117
</Pressable>
108118
<Modal
109119
transparent
@@ -115,7 +125,10 @@ function HeaderControls({ onAppRefresh }: { onAppRefresh: () => void }) {
115125
<Pressable style={styles.backdrop} onPress={closeMenu} />
116126
<View style={styles.menuAnchor}>
117127
<View style={styles.menuCard}>
118-
<Pressable style={styles.menuItem} onPress={toggleSimulatedOffline}>
128+
<Pressable
129+
style={styles.menuItem}
130+
onPress={toggleSimulatedOffline}
131+
>
119132
<Text style={styles.menuText}>
120133
{isSimulatedOffline
121134
? `Disable simulated offline mode`

examples/react-native/shopping-list/server/index.ts

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,13 @@ app.post('/api/shapes/items', async (req, res) => {
260260
})
261261

262262
app.get('/api/lists', async (_req, res) => {
263-
const rows = await sql<Array<{
264-
id: string
265-
name: string
266-
createdAt: unknown
267-
}>>`
263+
const rows = await sql<
264+
Array<{
265+
id: string
266+
name: string
267+
createdAt: unknown
268+
}>
269+
>`
268270
SELECT id, name, "createdAt"
269271
FROM shopping_lists
270272
ORDER BY "createdAt" DESC
@@ -282,12 +284,14 @@ app.post('/api/lists', async (req, res) => {
282284
return res.status(400).json({ error: `List name is required` })
283285
}
284286

285-
const [inserted] = await sql<Array<{
286-
txid: string
287-
id: string
288-
name: string
289-
createdAt: unknown
290-
}>>`
287+
const [inserted] = await sql<
288+
Array<{
289+
txid: string
290+
id: string
291+
name: string
292+
createdAt: unknown
293+
}>
294+
>`
291295
WITH tx AS (
292296
SELECT pg_current_xact_id()::xid::text as txid
293297
),
@@ -369,13 +373,15 @@ app.delete('/api/lists/:id', async (req, res) => {
369373
})
370374

371375
app.get('/api/items', async (_req, res) => {
372-
const rows = await sql<Array<{
373-
id: string
374-
listId: string
375-
text: string
376-
checked: boolean
377-
createdAt: unknown
378-
}>>`
376+
const rows = await sql<
377+
Array<{
378+
id: string
379+
listId: string
380+
text: string
381+
checked: boolean
382+
createdAt: unknown
383+
}>
384+
>`
379385
SELECT id, "listId", text, checked, "createdAt"
380386
FROM shopping_items
381387
ORDER BY "createdAt" ASC
@@ -396,14 +402,16 @@ app.post('/api/items', async (req, res) => {
396402
return res.status(400).json({ error: `listId and text are required` })
397403
}
398404

399-
const [inserted] = await sql<Array<{
400-
txid: string
401-
id: string
402-
listId: string
403-
text: string
404-
checked: boolean
405-
createdAt: unknown
406-
}>>`
405+
const [inserted] = await sql<
406+
Array<{
407+
txid: string
408+
id: string
409+
listId: string
410+
text: string
411+
checked: boolean
412+
createdAt: unknown
413+
}>
414+
>`
407415
WITH tx AS (
408416
SELECT pg_current_xact_id()::xid::text as txid
409417
),
@@ -507,7 +515,9 @@ async function start() {
507515
})
508516
} catch (error) {
509517
console.error(`Failed to start shopping-list server`, error)
510-
console.error(`Did you run 'pnpm db:up' in examples/react-native/shopping-list?`)
518+
console.error(
519+
`Did you run 'pnpm db:up' in examples/react-native/shopping-list?`,
520+
)
511521
process.exit(1)
512522
}
513523
}

examples/react-native/shopping-list/src/components/ListDetail.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
TouchableOpacity,
88
View,
99
} from 'react-native'
10-
import { eq, useLiveQuery } from '@tanstack/react-db'
10+
import { eq, useLiveQuery } from '@tanstack/react-db'
1111
import { itemsCollection } from '../db/collections'
1212
import { useShopping } from '../db/ShoppingContext'
1313

@@ -53,20 +53,12 @@ function ItemRow({
5353
return (
5454
<View style={styles.itemRow}>
5555
<TouchableOpacity
56-
style={[
57-
styles.checkbox,
58-
item.checked && styles.checkboxChecked,
59-
]}
56+
style={[styles.checkbox, item.checked && styles.checkboxChecked]}
6057
onPress={onToggle}
6158
>
6259
{item.checked && <Text style={styles.checkmark}></Text>}
6360
</TouchableOpacity>
64-
<Text
65-
style={[
66-
styles.itemText,
67-
item.checked && styles.itemTextChecked,
68-
]}
69-
>
61+
<Text style={[styles.itemText, item.checked && styles.itemTextChecked]}>
7062
{item.text}
7163
</Text>
7264
{showSavingBadge ? (

examples/react-native/shopping-list/src/components/ListsScreen.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function ListCard({
3838
const totalCount = (totalData as any)?.[0]?.n ?? 0
3939
const checkedCount = (checkedData as any)?.[0]?.n ?? 0
4040
const uncheckedPreview =
41-
((uncheckedPreviewData as any) as Array<{ text: string }> | undefined) ?? []
41+
(uncheckedPreviewData as any as Array<{ text: string }> | undefined) ?? []
4242
const uncheckedCount = Math.max(0, totalCount - checkedCount)
4343
const remainingCount = Math.max(0, uncheckedCount - uncheckedPreview.length)
4444
const previewText = uncheckedPreview
@@ -103,11 +103,7 @@ function ListCard({
103103
export function ListsScreen() {
104104
const router = useRouter()
105105
const [newListName, setNewListName] = useState(``)
106-
const {
107-
listActions,
108-
isInitialized,
109-
initError,
110-
} = useShopping()
106+
const { listActions, isInitialized, initError } = useShopping()
111107

112108
// ★ Includes query with aggregate subqueries: each list gets child collections
113109
// with computed counts. ListCard subscribes to them via useLiveQuery.

examples/react-native/shopping-list/src/db/ShoppingContext.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ const ShoppingContext = createContext<ShoppingContextValue | null>(null)
4141
export function ShoppingProvider({ children }: { children: React.ReactNode }) {
4242
const [offline, setOffline] = useState<OfflineExecutor | null>(null)
4343
const [isNetworkOnline, setIsNetworkOnline] = useState(true)
44-
const [isSimulatedOfflineState, setIsSimulatedOfflineState] = useState(
45-
isSimulatedOffline(),
46-
)
44+
const [isSimulatedOfflineState, setIsSimulatedOfflineState] =
45+
useState(isSimulatedOffline())
4746
const [pendingCount, setPendingCount] = useState(0)
4847
const [isInitialized, setIsInitialized] = useState(false)
4948
const [initError, setInitError] = useState<string | null>(null)

examples/react-native/shopping-list/src/network/SimulatedOnlineDetector.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import {
2-
3-
ReactNativeOnlineDetector
4-
} from '@tanstack/offline-transactions/react-native'
1+
import { ReactNativeOnlineDetector } from '@tanstack/offline-transactions/react-native'
52
import {
63
isSimulatedOffline,
74
subscribeSimulatedOffline,
85
} from './simulatedOffline'
9-
import type {OnlineDetector} from '@tanstack/offline-transactions/react-native';
6+
import type { OnlineDetector } from '@tanstack/offline-transactions/react-native'
107

118
class SimulatedOnlineDetector implements OnlineDetector {
129
private readonly baseDetector = new ReactNativeOnlineDetector()

0 commit comments

Comments
 (0)