Skip to content

Commit

Permalink
fix(rn): delete subscribe in db persist
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jan 6, 2025
1 parent f9d5d76 commit e2c9459
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
16 changes: 4 additions & 12 deletions apps/mobile/src/modules/subscription/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 }) => {
Expand Down Expand Up @@ -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(
Expand All @@ -442,6 +433,7 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
)}
</ItemPressable>
</SubscriptionFeedItemContextMenu>
// </ReAnimated.View>
// </Swipeable>
)
})
Expand Down
4 changes: 3 additions & 1 deletion apps/mobile/src/services/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/store/subscription/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class SubscriptionSyncService {
})

tx.persist(() => {
return SubscriptionService.delete(subscriptionId)
return SubscriptionService.delete(storeDbMorph.toSubscriptionSchema(subscription))
})

tx.request(async () => {
Expand Down

0 comments on commit e2c9459

Please sign in to comment.