From b91c09d54b75a15ab84285f09863c8a7f6300f9b Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 05:52:38 +0530 Subject: [PATCH 1/8] fix(mobile): correct sync and update actions Fixes #238 Fixes #199 Fixes #200 --- apps/mobile/app/settings/notifications.tsx | 6 +++++- apps/mobile/components/UpdateRequiredNotice.tsx | 11 ++++++++--- apps/mobile/components/social/NetworkHomeScreen.tsx | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/mobile/app/settings/notifications.tsx b/apps/mobile/app/settings/notifications.tsx index a726b75f..e863587d 100644 --- a/apps/mobile/app/settings/notifications.tsx +++ b/apps/mobile/app/settings/notifications.tsx @@ -148,6 +148,7 @@ export default function NotificationSettingsScreen() { null, ); const [saving, setSaving] = React.useState(false); + const registrationInFlight = React.useRef(false); const [error, setError] = React.useState(''); React.useEffect(() => { @@ -159,15 +160,19 @@ export default function NotificationSettingsScreen() { 'checking' | 'registered' | 'failed' | 'offline' >('checking'); const register = React.useCallback(async () => { + if (registrationInFlight.current) return; if (!isConnected) { setRegistration('offline'); return; } + registrationInFlight.current = true; setRegistration('checking'); try { setRegistration((await registerForPush(convex)) === 'registered' ? 'registered' : 'failed'); } catch { setRegistration('failed'); + } finally { + registrationInFlight.current = false; } }, [convex, isConnected]); React.useEffect(() => { @@ -202,7 +207,6 @@ export default function NotificationSettingsScreen() { setPermission(granted ? 'granted' : 'denied'); if (granted && userId) { await reconcileRecurringNotifications(userId); - await register(); } } catch { setError('Could not request notification permission.'); diff --git a/apps/mobile/components/UpdateRequiredNotice.tsx b/apps/mobile/components/UpdateRequiredNotice.tsx index b80067e7..fe871192 100644 --- a/apps/mobile/components/UpdateRequiredNotice.tsx +++ b/apps/mobile/components/UpdateRequiredNotice.tsx @@ -1,12 +1,13 @@ import React from 'react'; -import { Linking, Pressable, Text, View } from 'react-native'; +import { Linking, Platform, Pressable, Text, View } from 'react-native'; import { useConvexAuth, useQuery } from 'convex/react'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { api } from '@convex/_generated/api'; import { updateRequired } from '@finapp/ui/version'; import type { ThemeTokens } from '@finapp/ui/tokens'; -const STORE_URL = 'https://play.google.com/store/apps/details?id=com.neerajcodz.finapp'; +const IOS_STORE_URL = 'https://apps.apple.com/search?term=Finapp'; +const ANDROID_STORE_URL = 'https://play.google.com/store/apps/details?id=com.neerajcodz.finapp'; /** * Asks the user to update when this build is older than the backend's minimum supported @@ -40,7 +41,11 @@ export function UpdateRequiredNotice({ tokens }: { tokens: ThemeTokens }) { void Linking.openURL(STORE_URL).catch(() => undefined)} + onPress={() => + void Linking.openURL(Platform.OS === 'ios' ? IOS_STORE_URL : ANDROID_STORE_URL).catch( + () => undefined, + ) + } hitSlop={8} > Update diff --git a/apps/mobile/components/social/NetworkHomeScreen.tsx b/apps/mobile/components/social/NetworkHomeScreen.tsx index 40aba0ad..93cdff8e 100644 --- a/apps/mobile/components/social/NetworkHomeScreen.tsx +++ b/apps/mobile/components/social/NetworkHomeScreen.tsx @@ -78,8 +78,8 @@ export default function NetworkHomeScreen() { const { tokens } = useTheme(); const { width: viewportWidth } = useWindowDimensions(); const insets = useSafeAreaInsets(); - const { userId, isConnected, isSyncing, failedEntries, syncError } = useLocalSync(); - const syncAttention = Boolean(syncError) || failedEntries.length > 0; + const { userId, isConnected, isSyncing, failedEntries, conflicts, syncError } = useLocalSync(); + const syncAttention = Boolean(syncError) || failedEntries.length > 0 || conflicts.length > 0; const SyncIcon = !isConnected ? CloudOff : syncAttention From 43a0353f3a517d0a5b6eb48397e8cd12b45fafca Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 05:54:43 +0530 Subject: [PATCH 2/8] fix(receipts): preserve user edits when currency changes Fixes #195 --- apps/mobile/app/transaction/new.tsx | 9 +++++++++ .../components/finance/SplitExpenseForm.tsx | 9 +++++++++ .../components/finance/useReceiptScanner.tsx | 20 +++++++++---------- apps/web/app/(finance)/split/NewSplitForm.tsx | 9 +++++++++ .../app/(finance)/transaction/new/page.tsx | 9 +++++++++ .../components/finance/useReceiptScanner.tsx | 20 +++++++++---------- 6 files changed, 54 insertions(+), 22 deletions(-) diff --git a/apps/mobile/app/transaction/new.tsx b/apps/mobile/app/transaction/new.tsx index 8ff0f69e..cf87dcb0 100644 --- a/apps/mobile/app/transaction/new.tsx +++ b/apps/mobile/app/transaction/new.tsx @@ -124,6 +124,15 @@ export default function NewTransactionScreen() { if (fields.categoryId) setCategoryId(fields.categoryId); setReview(scanReview); }, + onCurrencyChange: (fields) => { + const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); + setAmount(fields.amount); + setItems((current) => + current.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ), + ); + }, }); const itemsState = personalItemsState(type === 'transfer' ? null : items, itemCurrency, amount); let amountMinor: bigint | null = null; diff --git a/apps/mobile/components/finance/SplitExpenseForm.tsx b/apps/mobile/components/finance/SplitExpenseForm.tsx index d468eb63..5de46503 100644 --- a/apps/mobile/components/finance/SplitExpenseForm.tsx +++ b/apps/mobile/components/finance/SplitExpenseForm.tsx @@ -73,6 +73,15 @@ export function SplitExpenseForm({ fixedGroupId }: { fixedGroupId?: string }) { }); setReview(scanReview); }, + onCurrencyChange: (fields) => { + const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); + composer.set('amount', fields.amount); + composer.setItems( + composer.items.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ), + ); + }, }); function chooseGroup(id: string) { diff --git a/apps/mobile/components/finance/useReceiptScanner.tsx b/apps/mobile/components/finance/useReceiptScanner.tsx index afa3029d..fa26fd2b 100644 --- a/apps/mobile/components/finance/useReceiptScanner.tsx +++ b/apps/mobile/components/finance/useReceiptScanner.tsx @@ -25,39 +25,37 @@ export function useReceiptScanner({ currency, disabled, onFields, + onCurrencyChange, onReview, }: { /** The composer's currency (account or group); also the parser's fallback currency. */ currency: string; disabled?: boolean; onFields: (fields: ReceiptFormFields, review: ReceiptReview) => void; + /** Updates only monetary values when currency precision changes after scanning. */ + onCurrencyChange: (fields: Pick) => void; /** Called with a fresh review when the composer's currency changes after a scan. */ onReview?: (review: ReceiptReview) => void; }) { const generateUploadUrl = useMutation(api.ai.receipts.generateUploadUrl); const registerUpload = useMutation(api.ai.receipts.registerUpload); const parse = useAction(api.ai.receipts.parse); + const onCurrencyChangeRef = React.useRef(onCurrencyChange); + onCurrencyChangeRef.current = onCurrencyChange; // The last scan, so switching account / group re-checks the bill's currency. const lastScan = React.useRef<{ draft: ReceiptDraft; currency: string } | null>(null); const onReviewRef = React.useRef(onReview); onReviewRef.current = onReview; - const onFieldsRef = React.useRef(onFields); - onFieldsRef.current = onFields; React.useEffect(() => { const last = lastScan.current; if (!last || !currency || last.currency === currency) return; const digitsChanged = (minorDigits(last.currency) ?? 2) !== (minorDigits(currency) ?? 2); last.currency = currency; - // Amounts depend on the currency's decimals (e.g. KWD 3 → INR 2): rebuild them, not just - // the review, so the rows stay valid for the new account. - // Only then are the rows rewritten; otherwise the user's edits are kept. const review = receiptReviewFor(last.draft, currency); - if (digitsChanged) - onFieldsRef.current(receiptDraftToForm(last.draft, currency), { - fields: review.fields, - itemIds: review.itemIds, - warnings: review.warnings, - }); + if (digitsChanged) { + const fields = receiptDraftToForm(last.draft, currency); + onCurrencyChangeRef.current({ amount: fields.amount, rows: fields.rows }); + } onReviewRef.current?.(review); }, [currency]); const scanner = useReceiptScan({ diff --git a/apps/web/app/(finance)/split/NewSplitForm.tsx b/apps/web/app/(finance)/split/NewSplitForm.tsx index d1de7bdb..1f898afa 100644 --- a/apps/web/app/(finance)/split/NewSplitForm.tsx +++ b/apps/web/app/(finance)/split/NewSplitForm.tsx @@ -74,6 +74,15 @@ export function NewSplitForm({ fixedGroupId }: { fixedGroupId?: string }) { }); setReview(scanReview); }, + onCurrencyChange: (fields) => { + const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); + composer.set('amount', fields.amount); + composer.setItems( + composer.items.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ), + ); + }, }); const saveLock = React.useRef(false); diff --git a/apps/web/app/(finance)/transaction/new/page.tsx b/apps/web/app/(finance)/transaction/new/page.tsx index dde6523f..f76b23de 100644 --- a/apps/web/app/(finance)/transaction/new/page.tsx +++ b/apps/web/app/(finance)/transaction/new/page.tsx @@ -289,6 +289,15 @@ export default function NewPersonalTransactionPage() { if (fields.categoryId) setCategoryId(fields.categoryId); setReview(scanReview); }, + onCurrencyChange: (fields) => { + const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); + setAmount(fields.amount); + setItems((current) => + current.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ), + ); + }, }); let amountValid: boolean; diff --git a/apps/web/components/finance/useReceiptScanner.tsx b/apps/web/components/finance/useReceiptScanner.tsx index 2d4f1eed..96b43a69 100644 --- a/apps/web/components/finance/useReceiptScanner.tsx +++ b/apps/web/components/finance/useReceiptScanner.tsx @@ -25,12 +25,15 @@ export function useReceiptScanner({ currency, disabled, onFields, + onCurrencyChange, onReview, }: { /** The composer's currency (account or group); also the parser's fallback currency. */ currency: string; disabled?: boolean; onFields: (fields: ReceiptFormFields, review: ReceiptReview) => void; + /** Updates only monetary values when currency precision changes after scanning. */ + onCurrencyChange: (fields: Pick) => void; /** Called with a fresh review when the composer's currency changes after a scan. */ onReview?: (review: ReceiptReview) => void; }) { @@ -41,23 +44,18 @@ export function useReceiptScanner({ const lastScan = React.useRef<{ draft: ReceiptDraft; currency: string } | null>(null); const onReviewRef = React.useRef(onReview); onReviewRef.current = onReview; - const onFieldsRef = React.useRef(onFields); - onFieldsRef.current = onFields; + const onCurrencyChangeRef = React.useRef(onCurrencyChange); + onCurrencyChangeRef.current = onCurrencyChange; React.useEffect(() => { const last = lastScan.current; if (!last || !currency || last.currency === currency) return; const digitsChanged = (minorDigits(last.currency) ?? 2) !== (minorDigits(currency) ?? 2); last.currency = currency; - // Amounts depend on the currency's decimals (e.g. KWD 3 → INR 2): rebuild them, not just - // the review, so the rows stay valid for the new account. - // Only then are the rows rewritten; otherwise the user's edits are kept. const review = receiptReviewFor(last.draft, currency); - if (digitsChanged) - onFieldsRef.current(receiptDraftToForm(last.draft, currency), { - fields: review.fields, - itemIds: review.itemIds, - warnings: review.warnings, - }); + if (digitsChanged) { + const fields = receiptDraftToForm(last.draft, currency); + onCurrencyChangeRef.current({ amount: fields.amount, rows: fields.rows }); + } onReviewRef.current?.(review); }, [currency]); const scanner = useReceiptScan({ From 88b9b5c2239d8862f51934da083d022a7bfad66d Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 06:20:46 +0530 Subject: [PATCH 3/8] fix(mobile): restore Goals routing and release metadata - Consolidate the Goals route and expose it from Profile. - Fix SemVer prerelease ordering, platform-specific build reporting, and release-note credits. - Require web clients to meet the 1.11.0 backend minimum. Fixes #201 Fixes #202 Fixes #205 Fixes #209 Fixes #220 Fixes #272 --- apps/mobile/app/(tabs)/_layout.tsx | 2 + apps/mobile/app/(tabs)/goals.tsx | 1 - apps/mobile/app/(tabs)/profile.tsx | 6 ++ apps/mobile/app/goals/index.tsx | 111 +------------------------ apps/mobile/components/GoalsScreen.tsx | 110 ++++++++++++++++++++++++ convex/shared/version.ts | 21 ++++- packages/ui/src/version/model.ts | 9 +- scripts/release-notes.mjs | 56 +++++++++---- scripts/version.mjs | 38 ++++++++- tests/shared/release-notes.test.ts | 37 +++++++++ tests/shared/versioning.test.ts | 43 +++++++++- version.json | 2 +- 12 files changed, 302 insertions(+), 134 deletions(-) delete mode 100644 apps/mobile/app/(tabs)/goals.tsx create mode 100644 apps/mobile/components/GoalsScreen.tsx create mode 100644 tests/shared/release-notes.test.ts diff --git a/apps/mobile/app/(tabs)/_layout.tsx b/apps/mobile/app/(tabs)/_layout.tsx index ff6e1fc3..ecb392cf 100644 --- a/apps/mobile/app/(tabs)/_layout.tsx +++ b/apps/mobile/app/(tabs)/_layout.tsx @@ -100,6 +100,8 @@ function BottomBar({ onAdd }: { onAdd: () => void }) { backgroundColor: tokens.background, borderTopWidth: 1, borderTopColor: tokens.borderSubtle, + zIndex: 10, + elevation: 10, }} > diff --git a/apps/mobile/app/(tabs)/goals.tsx b/apps/mobile/app/(tabs)/goals.tsx deleted file mode 100644 index b1622436..00000000 --- a/apps/mobile/app/(tabs)/goals.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from '../goals/index'; diff --git a/apps/mobile/app/(tabs)/profile.tsx b/apps/mobile/app/(tabs)/profile.tsx index 65b05950..34718b6d 100644 --- a/apps/mobile/app/(tabs)/profile.tsx +++ b/apps/mobile/app/(tabs)/profile.tsx @@ -295,6 +295,12 @@ export default function ProfileScreen() { description="Balances and activity" onPress={() => router.push('/accounts' as never)} /> + router.push('/goals' as never)} + /> { - if (typeof value === 'bigint') return value; - if (typeof value === 'number' && Number.isFinite(value)) return BigInt(Math.trunc(value)); - if (typeof value === 'string' && /^-?\d+$/.test(value)) return BigInt(value); - return 0n; -}; - -export default function GoalsScreen() { - const { userId, isConnected } = useLocalSync(); - const goals = useLocalRecords(userId, 'goal'); - const contributions = useLocalRecords(userId, 'goalContribution'); - const profiles = useLocalRecords(userId, 'profile'); - const settings = useLocalRecords( - userId, - 'settings', - ); - const currency = resolveDefaultCurrency(profiles.data, settings.data) ?? ''; - const activeGoals = (goals.data ?? []) - .filter((goal) => goal.archivedAt === undefined) - .sort( - (left, right) => - Number(Boolean(left.completedAt)) - Number(Boolean(right.completedAt)) || - (left.name ?? '').localeCompare(right.name ?? ''), - ); - const rows: GoalOverviewItem[] = activeGoals.map((goal) => { - const aliases = [goal.id, goal._id, goal.cloudId].filter( - (value): value is string => typeof value === 'string', - ); - const saved = (contributions.data ?? []) - .filter((entry) => typeof entry.goalId === 'string' && aliases.includes(entry.goalId)) - .reduce((sum, entry) => sum + toMinor(entry.amountMinor), 0n); - const target = toMinor(goal.targetAmountMinor); - return { - id: String(goal.id ?? goal._id ?? goal.cloudId ?? ''), - name: goal.name ?? 'Savings goal', - icon: goal.icon, - color: goal.color, - goalType: goal.goalType, - monthlyContributionMinor: - goal.monthlyContributionMinor !== undefined - ? toMinor(goal.monthlyContributionMinor) - : undefined, - accountId: goal.accountId, - priority: goal.priority, - notes: goal.notes, - reminderFrequency: goal.reminderFrequency, - saved, - target, - currency: goal.currency ?? currency ?? 'INR', - percent: target > 0n ? Number((saved * 100n) / target) : 0, - targetDate: goal.targetDate, - completed: goal.completedAt !== undefined, - }; - }); - const currencies = new Set(rows.map((row) => row.currency)); - const totalSaved = currencies.size === 1 ? rows.reduce((sum, row) => sum + row.saved, 0n) : null; - const loading = goals.loading || contributions.loading || profiles.loading || settings.loading; - const hasError = Boolean(goals.error || contributions.error || profiles.error || settings.error); - - return ( - router.push('/goals/new' as never)} - onOpen={(id) => router.push(`/goals/${id}` as never)} - onAnalytics={() => router.push('/goals/analytics' as never)} - onRetry={() => { - goals.retry(); - contributions.retry(); - profiles.retry(); - settings.retry(); - }} - onSetCurrency={() => router.push('/settings/currency' as never)} - /> - ); -} +export { default } from '@/components/GoalsScreen'; diff --git a/apps/mobile/components/GoalsScreen.tsx b/apps/mobile/components/GoalsScreen.tsx new file mode 100644 index 00000000..60bcaae7 --- /dev/null +++ b/apps/mobile/components/GoalsScreen.tsx @@ -0,0 +1,110 @@ +import { router } from 'expo-router'; +import { + GoalsOverviewScreen, + resolveDefaultCurrency, + type GoalOverviewItem, +} from '@finapp/ui/finance'; +import { useLocalSync } from '@/providers/LocalSyncProvider'; +import { useLocalRecords } from '@/hooks/useLocalRecords'; +import type { LocalRecord } from '@/local/repository'; + +type Goal = LocalRecord & { + id?: string; + name?: string; + targetAmountMinor?: bigint | number | string; + currency?: string; + archivedAt?: number; + completedAt?: number; + targetDate?: number; + icon?: string; + color?: string; + goalType?: string; + monthlyContributionMinor?: bigint | number | string; + accountId?: string; + priority?: 'low' | 'medium' | 'high'; + notes?: string; + reminderFrequency?: 'none' | 'weekly' | 'monthly'; + cloudId?: string; +}; +type Contribution = LocalRecord & { goalId?: string; amountMinor?: bigint | number | string }; +const toMinor = (value: unknown): bigint => { + if (typeof value === 'bigint') return value; + if (typeof value === 'number' && Number.isFinite(value)) return BigInt(Math.trunc(value)); + if (typeof value === 'string' && /^-?\d+$/.test(value)) return BigInt(value); + return 0n; +}; + +export default function GoalsScreen() { + const { userId, isConnected } = useLocalSync(); + const goals = useLocalRecords(userId, 'goal'); + const contributions = useLocalRecords(userId, 'goalContribution'); + const profiles = useLocalRecords(userId, 'profile'); + const settings = useLocalRecords( + userId, + 'settings', + ); + const currency = resolveDefaultCurrency(profiles.data, settings.data) ?? ''; + const activeGoals = (goals.data ?? []) + .filter((goal) => goal.archivedAt === undefined) + .sort( + (left, right) => + Number(Boolean(left.completedAt)) - Number(Boolean(right.completedAt)) || + (left.name ?? '').localeCompare(right.name ?? ''), + ); + const rows: GoalOverviewItem[] = activeGoals.map((goal) => { + const aliases = [goal.id, goal._id, goal.cloudId].filter( + (value): value is string => typeof value === 'string', + ); + const saved = (contributions.data ?? []) + .filter((entry) => typeof entry.goalId === 'string' && aliases.includes(entry.goalId)) + .reduce((sum, entry) => sum + toMinor(entry.amountMinor), 0n); + const target = toMinor(goal.targetAmountMinor); + return { + id: String(goal.id ?? goal._id ?? goal.cloudId ?? ''), + name: goal.name ?? 'Savings goal', + icon: goal.icon, + color: goal.color, + goalType: goal.goalType, + monthlyContributionMinor: + goal.monthlyContributionMinor !== undefined + ? toMinor(goal.monthlyContributionMinor) + : undefined, + accountId: goal.accountId, + priority: goal.priority, + notes: goal.notes, + reminderFrequency: goal.reminderFrequency, + saved, + target, + currency: goal.currency ?? currency ?? 'INR', + percent: target > 0n ? Number((saved * 100n) / target) : 0, + targetDate: goal.targetDate, + completed: goal.completedAt !== undefined, + }; + }); + const currencies = new Set(rows.map((row) => row.currency)); + const totalSaved = currencies.size === 1 ? rows.reduce((sum, row) => sum + row.saved, 0n) : null; + const loading = goals.loading || contributions.loading || profiles.loading || settings.loading; + const hasError = Boolean(goals.error || contributions.error || profiles.error || settings.error); + + return ( + router.push('/goals/new' as never)} + onOpen={(id) => router.push(`/goals/${id}` as never)} + onAnalytics={() => router.push('/goals/analytics' as never)} + onRetry={() => { + goals.retry(); + contributions.retry(); + profiles.retry(); + settings.retry(); + }} + onSetCurrency={() => router.push('/settings/currency' as never)} + /> + ); +} diff --git a/convex/shared/version.ts b/convex/shared/version.ts index 26ba6f4a..9914b98d 100644 --- a/convex/shared/version.ts +++ b/convex/shared/version.ts @@ -27,7 +27,7 @@ export const BACKEND_INFO = { apiVersion: 1, schemaVersion: 9, minimumMobileVersion: '1.11.0', - minimumWebVersion: '1.3.0', + minimumWebVersion: '1.11.0', } as const; /** Display string kept for existing callers ("v1.4.0"). */ @@ -45,5 +45,22 @@ export function compareVersions(left: string, right: string): number { } if (a[4] && !b[4]) return -1; if (!a[4] && b[4]) return 1; - return (a[4] ?? '').localeCompare(b[4] ?? ''); + if (!a[4] || !b[4]) return 0; + const leftIds = a[4].split('.'); + const rightIds = b[4].split('.'); + for (let index = 0; index < Math.min(leftIds.length, rightIds.length); index++) { + const leftId = leftIds[index]; + const rightId = rightIds[index]; + const leftNumeric = /^\d+$/.test(leftId); + const rightNumeric = /^\d+$/.test(rightId); + if (leftNumeric && rightNumeric) { + if (leftId.length !== rightId.length) return leftId.length < rightId.length ? -1 : 1; + if (leftId !== rightId) return leftId < rightId ? -1 : 1; + } else if (leftNumeric !== rightNumeric) { + return leftNumeric ? -1 : 1; + } else if (leftId !== rightId) { + return leftId < rightId ? -1 : 1; + } + } + return Math.sign(leftIds.length - rightIds.length); } diff --git a/packages/ui/src/version/model.ts b/packages/ui/src/version/model.ts index 3a1adc4c..072aa383 100644 --- a/packages/ui/src/version/model.ts +++ b/packages/ui/src/version/model.ts @@ -3,6 +3,7 @@ * versions come from version.json (through convex/shared/version.ts); the backend's live * values come from `api.system.info`. */ +import { Platform } from 'react-native'; import { BUILD_NUMBERS, COMPONENT_VERSIONS, @@ -27,6 +28,7 @@ export function versionRows(input: { backend: LiveBackendInfo | null | undefined; commit?: string; environment?: string; + nativePlatform?: 'android' | 'ios'; }): VersionRow[] { const backend = input.backend; const rows: VersionRow[] = [ @@ -43,11 +45,14 @@ export function versionRows(input: { { label: 'API version', value: backend ? String(backend.apiVersion) : '—' }, { label: 'Schema version', value: backend ? String(backend.schemaVersion) : '—' }, ]; - if (input.platform === 'mobile') + if (input.platform === 'mobile') { + const nativePlatform = input.nativePlatform ?? Platform.OS; + const platform = nativePlatform === 'ios' ? 'ios' : 'android'; rows.push({ label: 'Build', - value: `${BUILD_NUMBERS.android} (Android) · ${BUILD_NUMBERS.ios} (iOS)`, + value: `${BUILD_NUMBERS[platform]} (${platform === 'ios' ? 'iOS' : 'Android'})`, }); + } if (input.commit) rows.push({ label: 'Commit', value: input.commit }); if (input.environment) rows.push({ label: 'Environment', value: input.environment }); return rows; diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs index 0907fc40..79ba7bbe 100644 --- a/scripts/release-notes.mjs +++ b/scripts/release-notes.mjs @@ -18,24 +18,50 @@ import { fileURLToPath } from 'node:url'; const root = join(dirname(fileURLToPath(import.meta.url)), '..'); const manifestPath = process.argv[2] ?? join(root, 'version.json'); /** - * Wraps `@name` in backticks outside code spans so release notes never mention (link, notify or - * credit) a GitHub account by accident — e.g. the `@finai` chat mention. Emails are left alone, - * and GitHub's own "by @author in #123" credits are kept. + * Escapes user-authored mentions while leaving GitHub's generated PR author suffixes and + * first-contribution credits intact. */ export function escapeMentions(markdown) { + const escapeText = (text) => + text + .split(/(`[^`\n]*`)/) + .map((part, index) => + index % 2 === 1 + ? part + : part.replace(/(^|[^\w`])@([A-Za-z0-9][\w-]*)/g, '$1`@$2`'), + ) + .join(''); + + let inNewContributors = false; return markdown - .split(/(`[^`\n]*`)/) - .map((part, index) => - index % 2 === 1 - ? part - : part.replace(/(^|[^\w`])@([A-Za-z0-9][\w-]*)/g, (match, before, name, offset, text) => - /\bby $/.test(text.slice(0, offset + before.length)) && - /^ in /.test(text.slice(offset + match.length)) - ? match - : `${before}\`@${name}\``, - ), - ) - .join(''); + .split('\n') + .map((line) => { + if (/^##\s+New Contributors\s*$/i.test(line)) { + inNewContributors = true; + return line; + } + if (/^##\s+/.test(line)) inNewContributors = false; + + const credit = inNewContributors + ? /^(\s*[*-]\s+)(@[A-Za-z0-9][\w-]*)( made their first contribution in https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/\d+.*)$/.exec( + line, + ) + : null; + if (credit) { + return `${escapeText(credit[1])}${credit[2]}${escapeText(credit[3])}`; + } + + const author = + /(\s+by )(@[A-Za-z0-9][\w-]*)( in https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/\d+)\s*$/.exec( + line, + ); + if (author) { + const start = author.index; + return `${escapeText(line.slice(0, start))}${escapeText(author[1])}${author[2]}${escapeText(author[3])}`; + } + return escapeText(line); + }) + .join('\n'); } if (process.argv[2] === '--escape') { diff --git a/scripts/version.mjs b/scripts/version.mjs index 23b7db5d..619debc0 100644 --- a/scripts/version.mjs +++ b/scripts/version.mjs @@ -110,7 +110,24 @@ export function compareVersions(left, right) { } if (a[4] && !b[4]) return -1; if (!a[4] && b[4]) return 1; - return (a[4] ?? '').localeCompare(b[4] ?? ''); + if (!a[4] || !b[4]) return 0; + const leftIds = a[4].split('.'); + const rightIds = b[4].split('.'); + for (let index = 0; index < Math.min(leftIds.length, rightIds.length); index++) { + const leftId = leftIds[index]; + const rightId = rightIds[index]; + const leftNumeric = /^\d+$/.test(leftId); + const rightNumeric = /^\d+$/.test(rightId); + if (leftNumeric && rightNumeric) { + if (leftId.length !== rightId.length) return leftId.length < rightId.length ? -1 : 1; + if (leftId !== rightId) return leftId < rightId ? -1 : 1; + } else if (leftNumeric !== rightNumeric) { + return leftNumeric ? -1 : 1; + } else if (leftId !== rightId) { + return leftId < rightId ? -1 : 1; + } + } + return Math.sign(leftIds.length - rightIds.length); } function bumpVersion(version, type) { @@ -173,7 +190,24 @@ export function compareVersions(left: string, right: string): number { } if (a[4] && !b[4]) return -1; if (!a[4] && b[4]) return 1; - return (a[4] ?? '').localeCompare(b[4] ?? ''); + if (!a[4] || !b[4]) return 0; + const leftIds = a[4].split('.'); + const rightIds = b[4].split('.'); + for (let index = 0; index < Math.min(leftIds.length, rightIds.length); index++) { + const leftId = leftIds[index]; + const rightId = rightIds[index]; + const leftNumeric = /^\\d+$/.test(leftId); + const rightNumeric = /^\\d+$/.test(rightId); + if (leftNumeric && rightNumeric) { + if (leftId.length !== rightId.length) return leftId.length < rightId.length ? -1 : 1; + if (leftId !== rightId) return leftId < rightId ? -1 : 1; + } else if (leftNumeric !== rightNumeric) { + return leftNumeric ? -1 : 1; + } else if (leftId !== rightId) { + return leftId < rightId ? -1 : 1; + } + } + return Math.sign(leftIds.length - rightIds.length); } `; } diff --git a/tests/shared/release-notes.test.ts b/tests/shared/release-notes.test.ts new file mode 100644 index 00000000..083871b8 --- /dev/null +++ b/tests/shared/release-notes.test.ts @@ -0,0 +1,37 @@ +import { execFileSync } from 'node:child_process'; +import { join } from 'node:path'; +import { describe, expect, it } from 'vitest'; + +const root = join(__dirname, '..', '..'); +const escapeReleaseMentions = (text: string) => + execFileSync(process.execPath, ['scripts/release-notes.mjs', '--escape'], { + cwd: root, + encoding: 'utf8', + input: text, + }); + +describe('release note mention escaping', () => { + it('escapes PR-title mentions but preserves GitHub-generated credits', () => { + const notes = [ + '## What\'s Changed', + '* Add `@finai` support by @titleauthor in https://github.com/acme/app/pull/12 by @actualauthor in https://github.com/acme/app/pull/12', + '## New Contributors', + '* @newauthor made their first contribution in https://github.com/acme/app/pull/13', + ].join('\n'); + + expect(escapeReleaseMentions(notes)).toBe( + [ + '## What\'s Changed', + '* Add `@finai` support by `@titleauthor` in https://github.com/acme/app/pull/12 by @actualauthor in https://github.com/acme/app/pull/12', + '## New Contributors', + '* @newauthor made their first contribution in https://github.com/acme/app/pull/13', + ].join('\n'), + ); + }); + + it('does not preserve user-authored text that only resembles an author suffix', () => { + expect( + escapeReleaseMentions('* User wrote by @fake in #12').trim(), + ).toBe('* User wrote by `@fake` in #12'); + }); +}); diff --git a/tests/shared/versioning.test.ts b/tests/shared/versioning.test.ts index 7435c4e2..8e47e69f 100644 --- a/tests/shared/versioning.test.ts +++ b/tests/shared/versioning.test.ts @@ -1,8 +1,10 @@ +import { execFileSync } from 'node:child_process'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; import { BACKEND_INFO, + BUILD_NUMBERS, COMPONENT_VERSIONS, PRODUCT_VERSION, compareVersions, @@ -11,12 +13,29 @@ import { diagnosticsText, updateRequired, versionRows } from '../../packages/ui/ const root = join(__dirname, '..', '..'); const json = (file: string) => JSON.parse(readFileSync(join(root, file), 'utf8')); - +const compareScriptVersions = (left: string, right: string) => + Number( + execFileSync( + process.execPath, + [ + '--input-type=module', + '-e', + `process.argv[2] = 'show'; const { compareVersions } = await import(${JSON.stringify( + new URL('../../scripts/version.mjs', import.meta.url).href, + )}); console.log(compareVersions(${JSON.stringify(left)}, ${JSON.stringify(right)}));`, + ], + { cwd: root, encoding: 'utf8' }, + ) + .trim() + .split('\n') + .at(-1), + ); describe('version manifest', () => { it('is the source every generated file agrees with', () => { const manifest = json('version.json'); expect(PRODUCT_VERSION).toBe(manifest.version); expect(COMPONENT_VERSIONS).toEqual(manifest.components); + expect(BACKEND_INFO.minimumWebVersion).toBe(manifest.compatibility.minimumWebVersion); expect(json('apps/web/package.json').version).toBe(manifest.components.web); expect(json('apps/mobile/package.json').version).toBe(manifest.components.mobile); expect(json('packages/ui/package.json').version).toBe(manifest.components.ui); @@ -30,6 +49,15 @@ describe('compareVersions', () => { expect(compareVersions('1.4.0', '1.4.0')).toBe(0); expect(compareVersions('1.4.0-rc.1', '1.4.0')).toBe(-1); expect(compareVersions('2.0.0', '10.0.0')).toBe(-1); + expect(compareVersions('1.0.0-rc.2', '1.0.0-rc.10')).toBe(-1); + expect(compareVersions('1.0.0-rc.2', '1.0.0-rc.alpha')).toBe(-1); + }); + + it('orders prerelease identifiers by SemVer numeric and lexical rules', () => { + expect(compareScriptVersions('1.0.0-rc.2', '1.0.0-rc.10')).toBe(-1); + expect(compareScriptVersions('1.0.0-rc.2', '1.0.0-rc.alpha')).toBe(-1); + expect(compareScriptVersions('1.0.0-rc.alpha', '1.0.0-rc.beta')).toBe(-1); + expect(compareScriptVersions('1.0.0-rc', '1.0.0-rc.1')).toBe(-1); }); }); @@ -53,4 +81,17 @@ describe('client compatibility', () => { expect(text).toContain(`Backend: ${BACKEND_INFO.version}`); expect(text).toContain('Commit: abc1234'); }); + + it('reports the installed build number for the current native platform', () => { + expect( + versionRows({ platform: 'mobile', backend, nativePlatform: 'android' }).find( + (row) => row.label === 'Build', + )?.value, + ).toBe(`${BUILD_NUMBERS.android} (Android)`); + expect( + versionRows({ platform: 'mobile', backend, nativePlatform: 'ios' }).find( + (row) => row.label === 'Build', + )?.value, + ).toBe(`${BUILD_NUMBERS.ios} (iOS)`); + }); }); diff --git a/version.json b/version.json index 64398a8f..cf79deda 100644 --- a/version.json +++ b/version.json @@ -14,7 +14,7 @@ }, "compatibility": { "minimumMobileVersion": "1.11.0", - "minimumWebVersion": "1.3.0", + "minimumWebVersion": "1.11.0", "apiVersion": 1, "schemaVersion": 9 } From dc08a809f3b9f61bfcf81842a7965c3942eb1f7d Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 06:32:50 +0530 Subject: [PATCH 4/8] fix(mobile): resolve version and receipt typecheck errors - Narrow generated version identifiers for strict TypeScript checks. - Preserve the null receipt-item state during currency updates. Fixes #195 Fixes #201 --- apps/mobile/app/transaction/new.tsx | 4 ++-- convex/shared/version.ts | 4 ++-- scripts/version.mjs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/mobile/app/transaction/new.tsx b/apps/mobile/app/transaction/new.tsx index cf87dcb0..3eb6a59e 100644 --- a/apps/mobile/app/transaction/new.tsx +++ b/apps/mobile/app/transaction/new.tsx @@ -128,9 +128,9 @@ export default function NewTransactionScreen() { const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); setAmount(fields.amount); setItems((current) => - current.map((row) => + current?.map((row) => amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, - ), + ) ?? current, ); }, }); diff --git a/convex/shared/version.ts b/convex/shared/version.ts index 9914b98d..6f88b30f 100644 --- a/convex/shared/version.ts +++ b/convex/shared/version.ts @@ -49,8 +49,8 @@ export function compareVersions(left: string, right: string): number { const leftIds = a[4].split('.'); const rightIds = b[4].split('.'); for (let index = 0; index < Math.min(leftIds.length, rightIds.length); index++) { - const leftId = leftIds[index]; - const rightId = rightIds[index]; + const leftId = leftIds[index]!; + const rightId = rightIds[index]!; const leftNumeric = /^\d+$/.test(leftId); const rightNumeric = /^\d+$/.test(rightId); if (leftNumeric && rightNumeric) { diff --git a/scripts/version.mjs b/scripts/version.mjs index 619debc0..afe05c78 100644 --- a/scripts/version.mjs +++ b/scripts/version.mjs @@ -194,8 +194,8 @@ export function compareVersions(left: string, right: string): number { const leftIds = a[4].split('.'); const rightIds = b[4].split('.'); for (let index = 0; index < Math.min(leftIds.length, rightIds.length); index++) { - const leftId = leftIds[index]; - const rightId = rightIds[index]; + const leftId = leftIds[index]!; + const rightId = rightIds[index]!; const leftNumeric = /^\\d+$/.test(leftId); const rightNumeric = /^\\d+$/.test(rightId); if (leftNumeric && rightNumeric) { From 08ad8970d0dde64109391a3cfc30e105f2478ed7 Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 06:48:47 +0530 Subject: [PATCH 5/8] fix(receipts): preserve nullable currency edits - Keep a missing line-item state unchanged during currency precision updates. Fixes #195 --- apps/web/app/(finance)/transaction/new/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/app/(finance)/transaction/new/page.tsx b/apps/web/app/(finance)/transaction/new/page.tsx index f76b23de..a84155c7 100644 --- a/apps/web/app/(finance)/transaction/new/page.tsx +++ b/apps/web/app/(finance)/transaction/new/page.tsx @@ -293,9 +293,9 @@ export default function NewPersonalTransactionPage() { const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); setAmount(fields.amount); setItems((current) => - current.map((row) => + current?.map((row) => amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, - ), + ) ?? current, ); }, }); From 65c35a2ffce51ccb67c42cfe4bed4d2945fb21a3 Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 07:41:37 +0530 Subject: [PATCH 6/8] fix(mobile): report installed build metadata - Use native runtime build metadata in the About diagnostics. - Fixes #202. --- apps/mobile/app/about.tsx | 2 ++ packages/ui/src/version/model.ts | 9 ++++----- tests/shared/versioning.test.ts | 31 ++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/apps/mobile/app/about.tsx b/apps/mobile/app/about.tsx index 19c07408..eb5013c6 100644 --- a/apps/mobile/app/about.tsx +++ b/apps/mobile/app/about.tsx @@ -28,6 +28,8 @@ export default function AboutRoute() { backend: live, commit: extra.gitSha, environment: __DEV__ ? 'development' : 'production', + nativeBuildNumber: Constants.nativeBuildVersion, + nativePlatform: Platform.OS === 'ios' ? 'ios' : 'android', }); const storeUrl = Platform.OS === 'ios' diff --git a/packages/ui/src/version/model.ts b/packages/ui/src/version/model.ts index 072aa383..4a40d75f 100644 --- a/packages/ui/src/version/model.ts +++ b/packages/ui/src/version/model.ts @@ -3,9 +3,7 @@ * versions come from version.json (through convex/shared/version.ts); the backend's live * values come from `api.system.info`. */ -import { Platform } from 'react-native'; import { - BUILD_NUMBERS, COMPONENT_VERSIONS, PRODUCT_VERSION, RELEASE_CHANNEL, @@ -28,6 +26,7 @@ export function versionRows(input: { backend: LiveBackendInfo | null | undefined; commit?: string; environment?: string; + nativeBuildNumber?: string | null; nativePlatform?: 'android' | 'ios'; }): VersionRow[] { const backend = input.backend; @@ -46,11 +45,11 @@ export function versionRows(input: { { label: 'Schema version', value: backend ? String(backend.schemaVersion) : '—' }, ]; if (input.platform === 'mobile') { - const nativePlatform = input.nativePlatform ?? Platform.OS; - const platform = nativePlatform === 'ios' ? 'ios' : 'android'; + const platformName = + input.nativePlatform === 'ios' ? 'iOS' : input.nativePlatform === 'android' ? 'Android' : ''; rows.push({ label: 'Build', - value: `${BUILD_NUMBERS[platform]} (${platform === 'ios' ? 'iOS' : 'Android'})`, + value: `${input.nativeBuildNumber ?? 'Unavailable'}${platformName ? ` (${platformName})` : ''}`, }); } if (input.commit) rows.push({ label: 'Commit', value: input.commit }); diff --git a/tests/shared/versioning.test.ts b/tests/shared/versioning.test.ts index 8e47e69f..875df5ad 100644 --- a/tests/shared/versioning.test.ts +++ b/tests/shared/versioning.test.ts @@ -4,7 +4,6 @@ import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; import { BACKEND_INFO, - BUILD_NUMBERS, COMPONENT_VERSIONS, PRODUCT_VERSION, compareVersions, @@ -84,14 +83,28 @@ describe('client compatibility', () => { it('reports the installed build number for the current native platform', () => { expect( - versionRows({ platform: 'mobile', backend, nativePlatform: 'android' }).find( - (row) => row.label === 'Build', - )?.value, - ).toBe(`${BUILD_NUMBERS.android} (Android)`); + versionRows({ + platform: 'mobile', + backend, + nativeBuildNumber: '4200', + nativePlatform: 'android', + }).find((row) => row.label === 'Build')?.value, + ).toBe('4200 (Android)'); expect( - versionRows({ platform: 'mobile', backend, nativePlatform: 'ios' }).find( - (row) => row.label === 'Build', - )?.value, - ).toBe(`${BUILD_NUMBERS.ios} (iOS)`); + versionRows({ + platform: 'mobile', + backend, + nativeBuildNumber: '17', + nativePlatform: 'ios', + }).find((row) => row.label === 'Build')?.value, + ).toBe('17 (iOS)'); + expect( + versionRows({ + platform: 'mobile', + backend, + nativeBuildNumber: null, + nativePlatform: 'ios', + }).find((row) => row.label === 'Build')?.value, + ).toBe('Unavailable (iOS)'); }); }); From 740dcb8c988844f40d6d0a945954db2af8c70043 Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 08:04:57 +0530 Subject: [PATCH 7/8] fix(mobile): satisfy release and transaction formatting - Reflow the flagged transaction form, release-note helper, and test assertion. --- apps/mobile/app/transaction/new.tsx | 3 +-- scripts/release-notes.mjs | 4 +++- tests/shared/release-notes.test.ts | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/mobile/app/transaction/new.tsx b/apps/mobile/app/transaction/new.tsx index 3eb6a59e..34777eaa 100644 --- a/apps/mobile/app/transaction/new.tsx +++ b/apps/mobile/app/transaction/new.tsx @@ -53,8 +53,7 @@ export default function NewTransactionScreen() { const [categoryId, setCategoryId] = useState(scalar(params.categoryId) ?? ''); const [destinationId, setDestinationId] = useState(scalar(params.destinationId) ?? ''); const [occurredAt, setOccurredAt] = useState(() => { - const date = - Number.isFinite(initialDate) && initialDate > 0 ? new Date(initialDate) : new Date(); + const date = Number.isFinite(initialDate) && initialDate > 0 ? new Date(initialDate) : new Date(); if (!Number.isFinite(initialDate) || initialDate <= 0) date.setHours(12, 0, 0, 0); return date.getTime(); }); diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs index 79ba7bbe..1fa613fc 100644 --- a/scripts/release-notes.mjs +++ b/scripts/release-notes.mjs @@ -57,7 +57,9 @@ export function escapeMentions(markdown) { ); if (author) { const start = author.index; - return `${escapeText(line.slice(0, start))}${escapeText(author[1])}${author[2]}${escapeText(author[3])}`; + return `${escapeText(line.slice(0, start))}${escapeText(author[1])}${author[2]}${escapeText( + author[3], + )}`; } return escapeText(line); }) diff --git a/tests/shared/release-notes.test.ts b/tests/shared/release-notes.test.ts index 083871b8..81346f5a 100644 --- a/tests/shared/release-notes.test.ts +++ b/tests/shared/release-notes.test.ts @@ -30,8 +30,8 @@ describe('release note mention escaping', () => { }); it('does not preserve user-authored text that only resembles an author suffix', () => { - expect( - escapeReleaseMentions('* User wrote by @fake in #12').trim(), - ).toBe('* User wrote by `@fake` in #12'); + expect(escapeReleaseMentions('* User wrote by @fake in #12').trim()).toBe( + '* User wrote by `@fake` in #12', + ); }); }); From b93a9effa983f695451bc09f519c114990efc8a1 Mon Sep 17 00:00:00 2001 From: NeerajCodz Date: Fri, 27 Nov 2026 08:21:21 +0530 Subject: [PATCH 8/8] style(mobile): format transaction and release files - Apply the repository formatter to files flagged by CI. --- apps/mobile/app/transaction/new.tsx | 20 ++++++++++--------- .../app/(finance)/transaction/new/page.tsx | 15 +++++++------- scripts/release-notes.mjs | 4 +--- tests/shared/release-notes.test.ts | 4 ++-- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/apps/mobile/app/transaction/new.tsx b/apps/mobile/app/transaction/new.tsx index 34777eaa..94a0a37b 100644 --- a/apps/mobile/app/transaction/new.tsx +++ b/apps/mobile/app/transaction/new.tsx @@ -53,7 +53,8 @@ export default function NewTransactionScreen() { const [categoryId, setCategoryId] = useState(scalar(params.categoryId) ?? ''); const [destinationId, setDestinationId] = useState(scalar(params.destinationId) ?? ''); const [occurredAt, setOccurredAt] = useState(() => { - const date = Number.isFinite(initialDate) && initialDate > 0 ? new Date(initialDate) : new Date(); + const date = + Number.isFinite(initialDate) && initialDate > 0 ? new Date(initialDate) : new Date(); if (!Number.isFinite(initialDate) || initialDate <= 0) date.setHours(12, 0, 0, 0); return date.getTime(); }); @@ -94,13 +95,13 @@ export default function NewTransactionScreen() { ); const accountDefault = Boolean( account && - profile?.defaultAccountId && - [account.id, account._id, account.cloudId].includes(profile.defaultAccountId), + profile?.defaultAccountId && + [account.id, account._id, account.cloudId].includes(profile.defaultAccountId), ); const categoryDefault = Boolean( category && - defaultCategoryId && - [category.id, category._id, category.cloudId].includes(defaultCategoryId), + defaultCategoryId && + [category.id, category._id, category.cloudId].includes(defaultCategoryId), ); useEffect(() => { if (type !== 'transfer' && !categoryId && category) setCategoryId(recordId(category)); @@ -126,10 +127,11 @@ export default function NewTransactionScreen() { onCurrencyChange: (fields) => { const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); setAmount(fields.amount); - setItems((current) => - current?.map((row) => - amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, - ) ?? current, + setItems( + (current) => + current?.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ) ?? current, ); }, }); diff --git a/apps/web/app/(finance)/transaction/new/page.tsx b/apps/web/app/(finance)/transaction/new/page.tsx index a84155c7..b87b9296 100644 --- a/apps/web/app/(finance)/transaction/new/page.tsx +++ b/apps/web/app/(finance)/transaction/new/page.tsx @@ -85,9 +85,9 @@ export default function NewPersonalTransactionPage() { ); const isDefaultCategory = Boolean( type !== 'transfer' && - category && - profile?.[defaultCategoryField] && - aliasesOf(category).includes(profile[defaultCategoryField]!), + category && + profile?.[defaultCategoryField] && + aliasesOf(category).includes(profile[defaultCategoryField]!), ); React.useEffect(() => { @@ -292,10 +292,11 @@ export default function NewPersonalTransactionPage() { onCurrencyChange: (fields) => { const amounts = new Map(fields.rows.map((row) => [row.id, row.amount])); setAmount(fields.amount); - setItems((current) => - current?.map((row) => - amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, - ) ?? current, + setItems( + (current) => + current?.map((row) => + amounts.has(row.id) ? { ...row, amount: amounts.get(row.id)! } : row, + ) ?? current, ); }, }); diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs index 1fa613fc..641a9abb 100644 --- a/scripts/release-notes.mjs +++ b/scripts/release-notes.mjs @@ -26,9 +26,7 @@ export function escapeMentions(markdown) { text .split(/(`[^`\n]*`)/) .map((part, index) => - index % 2 === 1 - ? part - : part.replace(/(^|[^\w`])@([A-Za-z0-9][\w-]*)/g, '$1`@$2`'), + index % 2 === 1 ? part : part.replace(/(^|[^\w`])@([A-Za-z0-9][\w-]*)/g, '$1`@$2`'), ) .join(''); diff --git a/tests/shared/release-notes.test.ts b/tests/shared/release-notes.test.ts index 81346f5a..cf7c3df7 100644 --- a/tests/shared/release-notes.test.ts +++ b/tests/shared/release-notes.test.ts @@ -13,7 +13,7 @@ const escapeReleaseMentions = (text: string) => describe('release note mention escaping', () => { it('escapes PR-title mentions but preserves GitHub-generated credits', () => { const notes = [ - '## What\'s Changed', + "## What's Changed", '* Add `@finai` support by @titleauthor in https://github.com/acme/app/pull/12 by @actualauthor in https://github.com/acme/app/pull/12', '## New Contributors', '* @newauthor made their first contribution in https://github.com/acme/app/pull/13', @@ -21,7 +21,7 @@ describe('release note mention escaping', () => { expect(escapeReleaseMentions(notes)).toBe( [ - '## What\'s Changed', + "## What's Changed", '* Add `@finai` support by `@titleauthor` in https://github.com/acme/app/pull/12 by @actualauthor in https://github.com/acme/app/pull/12', '## New Contributors', '* @newauthor made their first contribution in https://github.com/acme/app/pull/13',