a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

get title and description from replicache state when updating

+19 -2
+19 -2
app/[leaflet_id]/actions/PublishButton.tsx
··· 68 68 let { identity } = useIdentityData(); 69 69 let toaster = useToaster(); 70 70 71 + // Get title and description from Replicache state (same as draft editor) 72 + // This ensures we use the latest edited values, not stale cached data 73 + let replicacheTitle = useSubscribe(rep, (tx) => 74 + tx.get<string>("publication_title"), 75 + ); 76 + let replicacheDescription = useSubscribe(rep, (tx) => 77 + tx.get<string>("publication_description"), 78 + ); 79 + 80 + // Use Replicache state if available, otherwise fall back to pub data 81 + const currentTitle = 82 + typeof replicacheTitle === "string" ? replicacheTitle : pub?.title || ""; 83 + const currentDescription = 84 + typeof replicacheDescription === "string" 85 + ? replicacheDescription 86 + : pub?.description || ""; 87 + 71 88 // Get tags from Replicache state (same as draft editor) 72 89 let tags = useSubscribe(rep, (tx) => tx.get<string[]>("publication_tags")); 73 90 const currentTags = Array.isArray(tags) ? tags : []; ··· 89 106 root_entity: rootEntity, 90 107 publication_uri: pub.publications?.uri, 91 108 leaflet_id: permission_token.id, 92 - title: pub.title, 93 - description: pub.description, 109 + title: currentTitle, 110 + description: currentDescription, 94 111 tags: currentTags, 95 112 cover_image: coverImage, 96 113 });