diff --git a/src/devhub/entity/post/List.jsx b/src/devhub/entity/post/List.jsx index 04007c4ed..cece362dd 100644 --- a/src/devhub/entity/post/List.jsx +++ b/src/devhub/entity/post/List.jsx @@ -61,14 +61,13 @@ function updateSearchCondition() { }); } -function getPostIds() { +function getPostIds(tag) { if (searchConditionChanged()) { updateSearchCondition(); - return; } let where = {}; let authorId = props.author; - let label = props.tag; + let label = tag || props.tag; if (authorId) { where = { author_id: { _eq: authorId }, ...where }; } @@ -141,7 +140,9 @@ State.init({ period: "week", }); -getPostIds(); +if (!state.items || searchConditionChanged()) { + getPostIds(); +} function defaultRenderItem(postId, additionalProps) { if (!additionalProps) { @@ -162,6 +163,12 @@ function defaultRenderItem(postId, additionalProps) { onDraftStateChange, ...additionalProps, referral: postId, + updateTagInParent: (tag) => { + if (typeof props.updateTagInput === "function") { + props.updateTagInput(tag); + } + getPostIds(tag); + }, }} /> diff --git a/src/devhub/entity/post/Post.jsx b/src/devhub/entity/post/Post.jsx index 2b42d6d7c..1f988fd29 100644 --- a/src/devhub/entity/post/Post.jsx +++ b/src/devhub/entity/post/Post.jsx @@ -646,11 +646,16 @@ const tags = post.snapshot.labels ? (
{ + if (typeof props.updateTagInParent === "function") { + props.updateTagInParent(tag); + } + }} className="d-flex gap-3 align-items-center" style={{ cursor: "pointer", textDecoration: "none" }} > diff --git a/src/devhub/feature/post-search/panel.jsx b/src/devhub/feature/post-search/panel.jsx index 40faf428e..f6e6da59a 100644 --- a/src/devhub/feature/post-search/panel.jsx +++ b/src/devhub/feature/post-search/panel.jsx @@ -147,6 +147,7 @@ return ( term: state.term, recency: props.recency, transactionHashes: props.transactionHashes, + updateTagInput: (tag) => State.update({ tag }), }} />