-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fixed issue for muliple tap were nedded to view sub issue. #9139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: preview
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -143,17 +143,15 @@ export const IssueBlock = observer(function IssueBlock(props: IssueBlockProps) { | |||||||
|
|
||||||||
| const marginLeft = `${spacingLeft}px`; | ||||||||
|
|
||||||||
| const handleToggleExpand = (e: MouseEvent<HTMLButtonElement>) => { | ||||||||
| const handleToggleExpand = async (e: MouseEvent<HTMLButtonElement>) => { | ||||||||
| e.stopPropagation(); | ||||||||
| e.preventDefault(); | ||||||||
| if (nestingLevel >= 3) { | ||||||||
| handleIssuePeekOverview(issue); | ||||||||
| } else { | ||||||||
| setExpanded((prevState) => { | ||||||||
| if (!prevState && workspaceSlug && issue && issue.project_id) | ||||||||
| subIssuesStore.fetchSubIssues(workspaceSlug.toString(), issue.project_id, issue.id); | ||||||||
| return !prevState; | ||||||||
| }); | ||||||||
| if (!isExpanded && workspaceSlug && issue.project_id) | ||||||||
| await subIssuesStore.fetchSubIssues(workspaceSlug.toString(), issue.project_id, issue.id); | ||||||||
| setExpanded((prevState) => !prevState); | ||||||||
| } | ||||||||
| }; | ||||||||
|
|
||||||||
|
|
@@ -321,6 +319,7 @@ export const IssueBlock = observer(function IssueBlock(props: IssueBlockProps) { | |||||||
| isEpic={isEpic} | ||||||||
| /> | ||||||||
| <div | ||||||||
| role="presentation" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove The This creates a contradiction: the element is marked as non-interactive but has interactive behavior. Either:
Since the div appears to be a click/keyboard event trap to prevent bubbling to the parent ♻️ Suggested alternativesOption 1: Remove the role attribute (simplest): <div
- role="presentation"
className={cn("hidden", {Option 2: If the div groups related actions, use <div
- role="presentation"
+ role="group"
+ aria-label="Quick actions"
className={cn("hidden", {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| className={cn("hidden", { | ||||||||
| "md:flex": isSidebarCollapsed, | ||||||||
| "lg:flex": !isSidebarCollapsed, | ||||||||
|
|
@@ -329,6 +328,10 @@ export const IssueBlock = observer(function IssueBlock(props: IssueBlockProps) { | |||||||
| e.preventDefault(); | ||||||||
| e.stopPropagation(); | ||||||||
| }} | ||||||||
| onKeyDown={(e) => { | ||||||||
| e.preventDefault(); | ||||||||
| e.stopPropagation(); | ||||||||
| }} | ||||||||
|
Comment on lines
+331
to
+334
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent default on all keyboard events breaks accessibility. The If the intent is to prevent specific keys from bubbling (e.g., only Enter or Space to avoid double-triggering the parent link), you should check ♿ Proposed fix for selective event handlingOnly prevent activation keys that might trigger the parent onKeyDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
+ // Only prevent Enter/Space to avoid triggering parent link
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ e.stopPropagation();
+ }
}}Alternatively, if you want to stop all propagation but still allow default browser behavior (like Tab navigation): onKeyDown={(e) => {
- e.preventDefault();
e.stopPropagation();
}}🤖 Prompt for AI Agents |
||||||||
| > | ||||||||
| {quickActions({ | ||||||||
| issue, | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against concurrent expand/collapse operations.
The async handler has no protection against rapid successive clicks. If a user clicks the expand button multiple times while
fetchSubIssuesis pending, multiple API calls will be triggered and the expanded state will toggle unpredictably.Consider adding a loading flag or disabling the button during the fetch operation.
🔒 Proposed fix with loading guard
Add a local state or use the store's loader:
And update the button to show loading state:
<button type="button" className="grid size-4 place-items-center rounded-xs text-placeholder hover:text-tertiary" onClick={handleToggleExpand} + disabled={isTogglingExpand} > + {isTogglingExpand ? ( + <Spinner className="size-4" /> + ) : ( <ChevronRightIcon className={cn("size-4", { "rotate-90": isExpanded, })} strokeWidth={2.5} /> + )} </button>🤖 Prompt for AI Agents
Add error handling for the async fetch operation.
The async
fetchSubIssuescall has no try-catch block. If the API call fails, the error will propagate as an unhandled promise rejection, and the expansion state will still toggle, leaving the UI in an inconsistent state (expanded chevron with no sub-issues loaded).As per coding guidelines, async operations should use try-catch with proper error types and log errors appropriately.
🛡️ Proposed fix with error handling
const handleToggleExpand = async (e: MouseEvent<HTMLButtonElement>) => { e.stopPropagation(); e.preventDefault(); if (nestingLevel >= 3) { handleIssuePeekOverview(issue); } else { - if (!isExpanded && workspaceSlug && issue.project_id) - await subIssuesStore.fetchSubIssues(workspaceSlug.toString(), issue.project_id, issue.id); - setExpanded((prevState) => !prevState); + if (!isExpanded && workspaceSlug && issue.project_id) { + try { + await subIssuesStore.fetchSubIssues(workspaceSlug, issue.project_id, issue.id); + setExpanded((prevState) => !prevState); + } catch (error) { + setToast({ + type: TOAST_TYPE.ERROR, + title: "Failed to load sub-issues", + message: error instanceof Error ? error.message : "An error occurred while fetching sub-issues", + }); + } + } else { + setExpanded((prevState) => !prevState); + } } };Note: Also removed redundant
.toString()onworkspaceSlug(already converted to string on line 82).🤖 Prompt for AI Agents