diff --git a/crates/workspace/src/views/repo_detail/issue_detail.rs b/crates/workspace/src/views/repo_detail/issue_detail.rs index 43ba3fb..1cfe6bf 100644 --- a/crates/workspace/src/views/repo_detail/issue_detail.rs +++ b/crates/workspace/src/views/repo_detail/issue_detail.rs @@ -21,16 +21,13 @@ use utils::relative_time; /// Detail panel of a single issue. pub struct IssueDetailView { - focus_handle: FocusHandle, /// Repo store holding the issues and their statuses. store: Entity, issue_id: EventId, + contents: HashMap, /// Input state of the "leave a comment" textarea. comment_input: Entity, - /// Issue/comment bodies as shared strings, keyed by event ID, so - /// re-renders don't clone full contents again (events are immutable, - /// so the cache never needs invalidation). - contents: HashMap, + focus_handle: FocusHandle, } impl IssueDetailView { @@ -283,7 +280,13 @@ impl Render for IssueDetailView { let content = self .contents .entry(issue.id) - .or_insert_with(|| SharedString::from(issue.content.clone())) + .or_insert_with(|| { + if issue.content.is_empty() { + SharedString::from("No description provided.") + } else { + SharedString::from(&issue.content) + } + }) .clone(); ( @@ -338,8 +341,7 @@ impl Render for IssueDetailView { h_flex() .gap_1() .child( - UserAvatar::new(author.clone()) - .picture(picture), + UserAvatar::new(&author).picture(picture), ) .child(author), )