fixing topic load

This commit is contained in:
balzack 2023-03-01 16:56:15 -08:00
parent 79d308a627
commit 16f829d6a5
3 changed files with 7 additions and 5 deletions

View File

@ -126,11 +126,13 @@ export function useConversationContext() {
if (entry.data) {
if (entry.data.detail) {
const item = mapTopicEntry(entry);
setTopicItem(cardId, channelId, item);
topics.current.set(item.topicId, item);
}
else {
const topic = await getTopic(cardId, channelId, entry.id);
const item = mapTopicEntry(entry);
setTopicItem(cardId, channelId, item);
topics.current.set(item.topicId, item);
}
}

View File

@ -1,7 +1,7 @@
import { useEffect, useState, useRef, useContext } from 'react';
import SQLite from "react-native-sqlite-storage";
const DATABAG_DB = 'db_v_110.db';
const DATABAG_DB = 'db_v_113.db';
export function useStoreContext() {
const [state, setState] = useState({});
@ -239,7 +239,7 @@ export function useStoreContext() {
},
setChannelTopicItem: async (guid, channelId, topic) => {
const { topicId, revision, detailRevision, detail } = topic;
await db.current.executeSql(`INSERT OR REPLACE INTO channel_topic_${guid} (channel_id, topic_id, revision, detail_revision, blocked detail, unsealed_detail) values (?, ?, ?, ?, false, ?, null);`, [channelId, topicId, revision, detailRevision, encodeObject(detail)]);
await db.current.executeSql(`INSERT OR REPLACE INTO channel_topic_${guid} (channel_id, topic_id, revision, detail_revision, blocked, detail, unsealed_detail) values (?, ?, ?, ?, false, ?, null);`, [channelId, topicId, revision, detailRevision, encodeObject(detail)]);
},
setChannelTopicItemUnsealedDetail: async (guid, channelId, topicId, revision, unsealed) => {
await db.current.executeSql(`UPDATE channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, channelId, topicId]);
@ -329,8 +329,8 @@ export function useStoreContext() {
}));
},
setCardChannelTopicItem: async (guid, cardId, channelId, topic) => {
const { id, revision, data } = topic;
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_topic_${guid} (card_id, channel_id, topic_id, revision, detail_revision, detail, unsealed_detail) values (?, ?, ?, ?, ?, ?, null);`, [cardId, channelId, id, revision, data.detailRevision, encodeObject(data.topicDetail)]);
const { topicId, revision, detailRevision, detail } = topic;
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_topic_${guid} (card_id, channel_id, topic_id, revision, detail_revision, detail, unsealed_detail) values (?, ?, ?, ?, ?, ?, null);`, [cardId, channelId, topicId, revision, detailRevision, encodeObject(detail)]);
},
setCardChannelTopicItemUnsealedDetail: async (guid, cardId, channelId, topicId, revision, unsealed) => {
await db.current.executeSql(`UPDATE card_channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND card_id=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, cardId, channelId, topicId]);

View File

@ -19,7 +19,7 @@ export function Conversation({ navigation, cardId, channelId, closeConversation,
navigation.setOptions({
headerTitle: () => (
<View style={styles.title}>
<Text style={styles.titletext}>{ state.subject }</Text>
<Text style={styles.titletext} numberOfLines={1} ellipsizeMode={'tail'}>{ state.subject }</Text>
</View>
),
headerRight: () => (