fix(rn): delete subscribe in db persist

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-01-06 23:46:50 +08:00
parent f9d5d7698c
commit e2c9459db8
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
3 changed files with 8 additions and 14 deletions

View File

@ -8,20 +8,12 @@ import { useAtom } from "jotai"
import { useColorScheme } from "nativewind"
import type { FC } from "react"
import { createContext, memo, useContext, useEffect, useMemo, useRef } from "react"
import {
Animated,
Easing,
Image,
StyleSheet,
Text,
TouchableOpacity,
useAnimatedValue,
View,
} from "react-native"
import { Animated, Easing, Image, StyleSheet, Text, useAnimatedValue, View } from "react-native"
import PagerView from "react-native-pager-view"
import { useSharedValue } from "react-native-reanimated"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { AnimatedTouchableOpacity } from "@/src/components/common/AnimatedComponents"
import { AccordionItem } from "@/src/components/ui/accordion"
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
@ -293,8 +285,6 @@ const UnGroupedList: FC<{
const GroupedContext = createContext<string | null>(null)
const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
// const CategoryList: FC<{
// grouped: Record<string, string[]>
// }> = ({ grouped }) => {
@ -416,6 +406,7 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
// prevOpenedRow = swipeableRef.current
// }}
// >
// <ReAnimated.View key={id} layout={CurvedTransition} exiting={FadeOut}>
<SubscriptionFeedItemContextMenu id={id} view={view}>
<ItemPressable
className={cn(
@ -442,6 +433,7 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
)}
</ItemPressable>
</SubscriptionFeedItemContextMenu>
// </ReAnimated.View>
// </Swipeable>
)
})

View File

@ -43,7 +43,9 @@ class SubscriptionServiceStatic implements Hydratable, Resetable {
)
}
async delete(id: string) {
async delete(subscription: SubscriptionSchema) {
const { id } = subscription
const result = await db.query.subscriptionsTable.findFirst({
where: eq(subscriptionsTable.id, id),
columns: {

View File

@ -252,7 +252,7 @@ class SubscriptionSyncService {
})
tx.persist(() => {
return SubscriptionService.delete(subscriptionId)
return SubscriptionService.delete(storeDbMorph.toSubscriptionSchema(subscription))
})
tx.request(async () => {