Skip to content

Commit

Permalink
fix: deleting character now closes chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Sep 20, 2024
1 parent 118f8fa commit 9905274
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/CharInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const CharInfo = () => {
const [characterCard, setCharacterCard] = useState<CharacterCardV2 | undefined>(currentCard)

const imageDir = Characters.getImageDir(currentCard?.data.image_id ?? -1)
const chat = Chats.useChat((state) => state.data)
const { chat, unloadChat } = Chats.useChat((state) => ({
chat: state.data,
unloadChat: state.reset,
}))

const [imageSource, setImageSource] = useState({
uri: imageDir,
Expand Down Expand Up @@ -87,7 +90,7 @@ const CharInfo = () => {
onPress: () => {
RecentMessages.deleteByCharacter(charName ?? '')
Characters.db.mutate.deleteCard(charId ?? -1)

unloadChat()
router.back()
},
style: 'destructive',
Expand Down

0 comments on commit 9905274

Please sign in to comment.