diff --git a/src/devhub/entity/post/PostEditor.jsx b/src/devhub/entity/post/PostEditor.jsx index b2de4e2e5..2ca5ebd68 100644 --- a/src/devhub/entity/post/PostEditor.jsx +++ b/src/devhub/entity/post/PostEditor.jsx @@ -263,6 +263,7 @@ const onSubmit = () => { }); } Near.call(txn); + } }; @@ -581,141 +582,159 @@ function generateDescription(text, amount, token, supervisor, seekingFunding) { } const [tab, setTab] = useState("editor"); +const [numPosts, setNumPosts] = useState(null); +const [numPostsChanged, setNumPostsChanged] = useState(false); +useEffect(() => { + const all_post_ids = Near.view("${REPL_DEVHUB_CONTRACT}", 'get_all_post_ids'); + if (all_post_ids) { + console.log(numPosts, all_post_ids.length); + if (numPosts !=null && numPosts != all_post_ids.length) { + console.log('numPosts changed'); + setNumPostsChanged(true); + } + setNumPosts(all_post_ids.length); + } +}); const renamedPostType = postType == "Submission" ? "Solution" : postType; // Below there is a weird code with fields.includes("githubLink") ternary operator. // This is to hack around rendering bug of near.social. -return ( -