mirror of
https://github.com/coracle-social/coracle.git
synced 2024-10-01 17:31:24 +00:00
Fix findNote
This commit is contained in:
parent
78a85be7e5
commit
4ec8178660
13
README.md
13
README.md
@ -19,10 +19,6 @@ Coracle is currently in _alpha_ - expect bugs, slow loading times, and rough edg
|
|||||||
- [ ] Image uploads
|
- [ ] Image uploads
|
||||||
- [ ] An actual readme
|
- [ ] An actual readme
|
||||||
- [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files
|
- [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files
|
||||||
- [ ] Favorite chat rooms
|
|
||||||
- [ ] Optimistically load events the user publishes (e.g. to reduce reflow for reactions/replies).
|
|
||||||
- Essentially, we can pretend to be our own in-memory relay.
|
|
||||||
- This allows us to keep a copy of all user data, and possibly user likes/reply parents
|
|
||||||
- [ ] Support invoices https://twitter.com/jb55/status/1604131336247476224
|
- [ ] Support invoices https://twitter.com/jb55/status/1604131336247476224
|
||||||
|
|
||||||
# Bugs
|
# Bugs
|
||||||
@ -47,3 +43,12 @@ Coracle is currently in _alpha_ - expect bugs, slow loading times, and rough edg
|
|||||||
- https://vitejs.dev/guide/features.html#web-workers
|
- https://vitejs.dev/guide/features.html#web-workers
|
||||||
- https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
|
- https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
|
||||||
- https://web.dev/module-workers/
|
- https://web.dev/module-workers/
|
||||||
|
|
||||||
|
- [ ] Sync user
|
||||||
|
- [ ] Based on petnames, sync network to 2 or 3 degrees of separation
|
||||||
|
- [ ] Main fetch requests:
|
||||||
|
- Fetch network, including feed
|
||||||
|
- Fetch person, including feed
|
||||||
|
- Fetch note, including context
|
||||||
|
- This is based on detail pages. Each request should check local db and fall back to network, all within an await.
|
||||||
|
- [ ] How will newcomers get followed?
|
||||||
|
@ -139,7 +139,7 @@ const findReaction = async (id, filter) =>
|
|||||||
const countReactions = async (id, filter) =>
|
const countReactions = async (id, filter) =>
|
||||||
(await filterReactions(id, filter)).length
|
(await filterReactions(id, filter)).length
|
||||||
|
|
||||||
const findNote = async (id, giveUp = false) => {
|
const findNote = async (id, {giveUp = false, showEntire = false} = {}) => {
|
||||||
const [note, children] = await Promise.all([
|
const [note, children] = await Promise.all([
|
||||||
db.events.get(id),
|
db.events.get(id),
|
||||||
db.events.where('reply').equals(id),
|
db.events.where('reply').equals(id),
|
||||||
@ -155,14 +155,14 @@ const findNote = async (id, giveUp = false) => {
|
|||||||
|
|
||||||
await ensureContext(await pool.loadEvents({ids: [id]}))
|
await ensureContext(await pool.loadEvents({ids: [id]}))
|
||||||
|
|
||||||
return findNote(id, true)
|
return findNote(id, {giveUp: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
const [replies, reactions, person, html] = await Promise.all([
|
const [replies, reactions, person, html] = await Promise.all([
|
||||||
children.clone().filter(e => e.kind === 1).toArray(),
|
children.clone().filter(e => e.kind === 1).toArray(),
|
||||||
children.clone().filter(e => e.kind === 7).toArray(),
|
children.clone().filter(e => e.kind === 7).toArray(),
|
||||||
db.people.get(note.pubkey),
|
db.people.get(note.pubkey),
|
||||||
renderNote(note, {showEntire: false}),
|
renderNote(note, {showEntire}),
|
||||||
])
|
])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user