Pre-calculate timestamp display for perf

This commit is contained in:
Jonathan Staab 2023-03-06 16:31:00 -06:00
parent 7d5f132e1f
commit 35c1b4b2ed
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,5 @@
# Current
- [ ] formatTimestamp is expensive, cache it by assigning to events
- [ ] Fix hover on notes in modal
- [ ] Show loading/success on zap invoice screen
- [ ] Fix iOS/safari/firefox
@ -36,6 +35,8 @@
# More
- [ ] Performance
- same deal as with formatTimestamp, don't use functions inline since svelte can't cache them
- [ ] Image Uploads
- [ ] Add LN invoices
- [ ] Contact other client authors, self-hostable, or just use my instance

View File

@ -55,6 +55,7 @@
let showRelays = false
const {profile} = user
const timestamp = formatTimestamp(note.created_at)
const borderColor = invertColors ? "medium" : "dark"
const links = extractUrls(note.content)
const showEntire = anchorId === note.id
@ -358,7 +359,7 @@
href={"/" + nip19.neventEncode({id: note.id, relays: [note.seen_on]})}
class="text-sm text-light"
type="unstyled">
{formatTimestamp(note.created_at)}
{timestamp}
</Anchor>
</div>
<div class="flex flex-col gap-2">