small fixes

This commit is contained in:
hzrd149 2023-10-28 11:48:08 -05:00
parent 02b8374adf
commit 5c036fffe6
4 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix error when clearing database cache

View File

@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix scrolling in direct messages view

View File

@ -1,5 +1,8 @@
import { openDB, deleteDB, IDBPDatabase } from "idb";
import { SchemaV1, SchemaV2, SchemaV3, SchemaV4 } from "./schema";
import { logger } from "../../helpers/debug";
const log = logger.extend("Database");
const dbName = "storage";
const version = 4;
@ -87,17 +90,31 @@ const db = await openDB<SchemaV4>(dbName, version, {
},
});
log("Open");
export async function clearCacheData() {
log("Clearing replaceableEvents");
await db.clear("replaceableEvents");
await db.clear("userFollows");
log("Clearing userSearch");
await db.clear("userSearch");
log("Clearing relayInfo");
await db.clear("relayInfo");
log("Clearing dnsIdentifiers");
await db.clear("dnsIdentifiers");
log("Clearing relayScoreboardStats");
await db.clear("relayScoreboardStats");
window.location.reload();
}
export async function deleteDatabase() {
log("Closing");
db.close();
log("Deleting");
await deleteDB(dbName);
window.location.reload();
}

View File

@ -22,6 +22,7 @@ import { useTimelineCurserIntersectionCallback } from "../../hooks/use-timeline-
import TimelineActionAndStatus from "../../components/timeline-page/timeline-action-and-status";
import NostrPublishAction from "../../classes/nostr-publish-action";
import { LightboxProvider } from "../../components/lightbox-provider";
import VerticalPageLayout from "../../components/vertical-page-layout";
function DirectMessageChatPage({ pubkey }: { pubkey: string }) {
const toast = useToast();
@ -71,7 +72,7 @@ function DirectMessageChatPage({ pubkey }: { pubkey: string }) {
return (
<LightboxProvider>
<IntersectionObserverProvider callback={callback}>
<Flex height="100%" overflow="hidden" direction="column">
<Flex maxH={{ base: "calc(100vh - 3.5rem)", md: "100vh" }} overflow="hidden" direction="column">
<Card size="sm" flexShrink={0}>
<CardBody display="flex" gap="2" alignItems="center">
<IconButton variant="ghost" icon={<ChevronLeftIcon />} aria-label="Back" onClick={() => navigate(-1)} />
@ -79,7 +80,7 @@ function DirectMessageChatPage({ pubkey }: { pubkey: string }) {
<UserLink pubkey={pubkey} />
</CardBody>
</Card>
<Flex flex={1} overflowX="hidden" overflowY="scroll" direction="column-reverse" gap="2" py="4" px="2">
<Flex h="0" flex={1} overflowX="hidden" overflowY="scroll" direction="column-reverse" gap="2" py="4" px="2">
{[...messages].map((event) => (
<Message key={event.id} event={event} />
))}