Skip to content

Commit

Permalink
Fix tag action (#537)
Browse files Browse the repository at this point in the history
* fix tag action

* remove old code

* update search tag
  • Loading branch information
Megha-Dev-19 authored Dec 1, 2023
1 parent 536b4f5 commit 52ea82a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/devhub/entity/post/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down Expand Up @@ -141,7 +140,9 @@ State.init({
period: "week",
});

getPostIds();
if (!state.items || searchConditionChanged()) {
getPostIds();
}

function defaultRenderItem(postId, additionalProps) {
if (!additionalProps) {
Expand All @@ -162,6 +163,12 @@ function defaultRenderItem(postId, additionalProps) {
onDraftStateChange,
...additionalProps,
referral: postId,
updateTagInParent: (tag) => {
if (typeof props.updateTagInput === "function") {
props.updateTagInput(tag);
}
getPostIds(tag);
},
}}
/>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/devhub/entity/post/Post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,16 @@ const tags = post.snapshot.labels ? (
<div className="d-flex align-items-center my-3 me-3">
<Link
to={href({
widgetSrc: "#/${REPL_DEVHUB}/widget/app",
widgetSrc: "${REPL_DEVHUB}/widget/app",
params: { page: "feed", tag: tag },
})}
>
<div
onClick={() => {
if (typeof props.updateTagInParent === "function") {
props.updateTagInParent(tag);
}
}}
className="d-flex gap-3 align-items-center"
style={{ cursor: "pointer", textDecoration: "none" }}
>
Expand Down
1 change: 1 addition & 0 deletions src/devhub/feature/post-search/panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ return (
term: state.term,
recency: props.recency,
transactionHashes: props.transactionHashes,
updateTagInput: (tag) => State.update({ tag }),
}}
/>
</PostContainer>
Expand Down

0 comments on commit 52ea82a

Please sign in to comment.