[WEB-6783] fix: crash when deleting work item from peek view in workspace spreadsheet#8821
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo issue rendering components now guard against missing issue entries in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
There was a problem hiding this comment.
Pull request overview
Fixes a UI crash when deleting a work item from the peek view in the workspace spreadsheet layout by ensuring “new issue” highlighting logic doesn’t run on deleted/missing issues in the client store.
Changes:
- Add a null guard in
SpreadsheetIssueRowwhen the issue no longer exists inissueMap. - Pass a concrete
issueobject toisIssueNewin spreadsheet row rendering (avoidsundefinedaccess). - Add an extra defensive guard around
isIssueNewin list layout rendering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/web/core/components/issues/issue-layouts/spreadsheet/issue-row.tsx | Guards against missing issue entries post-deletion and prevents isIssueNew from being called with undefined. |
| apps/web/core/components/issues/issue-layouts/list/block-root.tsx | Adds a defensive conditional around isIssueNew in list layout’s RenderIfVisible default rendering decision. |
| verticalOffset={100} | ||
| defaultValue={shouldRenderByDefault || isIssueNew(issuesMap[issueId])} | ||
| defaultValue={shouldRenderByDefault || (issuesMap[issueId] ? isIssueNew(issuesMap[issueId]) : false)} | ||
| placeholderChildren={<ListLoaderItemRow shouldAnimate={false} renderForPlaceHolder defaultPropertyCount={4} />} |
There was a problem hiding this comment.
IssueBlockRoot already returns early when issuesMap[issueId]?.created_at is falsy, so issuesMap[issueId] is guaranteed to exist at this point. The added ternary is redundant and also repeats the map lookup. Consider keeping the previous isIssueNew(issuesMap[issueId]) call, or assign const issue = issuesMap[issueId] after the guard and use that variable for clarity.
Summary
Cannot read properties of undefined (reading 'created_at')) when deleting a work item via peek view in workspace views spreadsheet layoutSpreadsheetIssueRowcalledisIssueNew(issueMap[issueId])without checking if the issue still exists in the MobX store after deletionreturn nullguard inSpreadsheetIssueRow(matching existing pattern in list view'sblock-root.tsx:130)isIssueNewcall in listblock-rootfor consistencyType of Change
Test cases
Summary by CodeRabbit