a tool for shared writing and social publishing

await a push before publishing

+21 -10
+3
app/[leaflet_id]/publish/PublishPost.tsx
··· 12 12 import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; 13 13 import { AtUri } from "@atproto/syntax"; 14 14 import { PublishIllustration } from "./PublishIllustration/PublishIllustration"; 15 + import { useReplicache } from "src/replicache"; 15 16 16 17 type Props = { 17 18 title: string; ··· 53 54 let [postContent, setPostContent] = useState(""); 54 55 let [isLoading, setIsLoading] = useState(false); 55 56 let params = useParams(); 57 + let { rep } = useReplicache(); 56 58 57 59 async function submit() { 58 60 if (isLoading) return; 59 61 setIsLoading(true); 62 + await rep?.push(); 60 63 let doc = await publishToPublication({ 61 64 root_entity: props.root_entity, 62 65 publication_uri: props.publication_uri,
+18 -10
app/[leaflet_id]/publish/page.tsx
··· 5 5 import { getIdentityData } from "actions/getIdentityData"; 6 6 7 7 import { AtpAgent } from "@atproto/api"; 8 + import { ReplicacheProvider } from "src/replicache"; 8 9 9 10 export const preferredRegion = ["sfo1"]; 10 11 export const dynamic = "force-dynamic"; ··· 41 42 42 43 let profile = await agent.getProfile({ actor: identity.atp_did }); 43 44 return ( 44 - <PublishPost 45 - leaflet_id={leaflet_id} 46 - root_entity={rootEntity} 47 - profile={profile.data} 48 - title={pub.title} 49 - publication_uri={pub.publication} 50 - description={pub.description} 51 - record={pub.publications?.record as PubLeafletPublication.Record} 52 - posts_in_pub={pub.publications?.documents_in_publications[0].count} 53 - /> 45 + <ReplicacheProvider 46 + rootEntity={rootEntity} 47 + token={res.data} 48 + name={rootEntity} 49 + initialFacts={[]} 50 + > 51 + <PublishPost 52 + leaflet_id={leaflet_id} 53 + root_entity={rootEntity} 54 + profile={profile.data} 55 + title={pub.title} 56 + publication_uri={pub.publication} 57 + description={pub.description} 58 + record={pub.publications?.record as PubLeafletPublication.Record} 59 + posts_in_pub={pub.publications?.documents_in_publications[0].count} 60 + /> 61 + </ReplicacheProvider> 54 62 ); 55 63 }