| … | … | @@ -475,14 +475,19 @@ const handlers = { |
| 475 | 475 | const langs = /^[a-z]{2}(-[A-Za-z0-9]{2,8})?$/.test(String(lang || '')) ? [String(lang)] : ['en'] |
| 476 | 476 | const r = await w.post(String(text || ''), { scope, langs, reply: replyTo, quote: quoteOf }) |
| 477 | 477 | const uri = 'at://' + viewerDid() + '/' + r.collection + '/' + r.rkey |
| 478 | | try { await state.appview.putPost({ did: viewerDid(), rkey: r.rkey, record: { $type: r.collection, text, createdAt: new Date().toISOString(), langs } }) } catch {} |
| 478 | // No optimistic index write. Every screen now reads favela-web's index, so writing into the |
| 479 | // worklet's own appview updated something nobody reads — a no-op that still looked like it worked. |
| 480 | // favela-web picks the record up itself: it holds hpp's overlay (ATPROTO_OVERLAY_ROOT) and follows |
| 481 | // the DID's firehose, and it indexes a local write promptly — observed on tabertron, where a post |
| 482 | // appeared in /api/timeline immediately after the write and left it immediately on delete. |
| 479 | 483 | return { ...r, uri } |
| 480 | 484 | }, |
| 481 | 485 | async deletePost ({ rkey, collection = 'app.bsky.feed.post' } = {}) { |
| 482 | 486 | if (!rkey) throw new Error('deletePost requires { rkey }') |
| 483 | 487 | const w = await writer() |
| 484 | 488 | await w.putRecord(collection, rkey, null, { action: 'delete' }) |
| 485 | | try { await state.appview.delPost({ did: viewerDid(), rkey }) } catch {} |
| 489 | // Same as compose: the optimistic delete updated an index no screen reads. favela-web drops it |
| 490 | // from its own on the firehose round-trip. |
| 486 | 491 | return { ok: true, rkey, collection } |
| 487 | 492 | }, |
| 488 | 493 | // Follow is a TOGGLE and needs no strongRef — its subject is a plain DID, unlike a like or a repost |