File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
frontend/src/components/backlog Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ import CategoryChip from "./CategoryChip";
6
6
import useEpicEmitEvent from "../../hooks/pages/backlog/useEpicEmitEvent" ;
7
7
import { CATEGORY_COLOR } from "../../constants/backlog" ;
8
8
import getRandomNumber from "../../utils/getRandomNumber" ;
9
- import { BacklogCategoryColor } from "../../types/common/backlog" ;
9
+ import {
10
+ BacklogCategoryColor ,
11
+ BacklogSocketData ,
12
+ BacklogSocketDomain ,
13
+ BacklogSocketEpicAction ,
14
+ } from "../../types/common/backlog" ;
10
15
import EpicDropdownOption from "./EpicDropdownOption" ;
11
16
12
17
interface EpicDropdownProps {
@@ -57,8 +62,23 @@ const EpicDropdown = ({
57
62
onEpicChange ( epicId ) ;
58
63
} ;
59
64
65
+ const handleEpicEvent = ( { domain, action, content } : BacklogSocketData ) => {
66
+ if (
67
+ domain === BacklogSocketDomain . EPIC &&
68
+ action === BacklogSocketEpicAction . CREATE &&
69
+ ! selectedEpic
70
+ ) {
71
+ onEpicChange ( content . id ) ;
72
+ }
73
+ } ;
74
+
60
75
useEffect ( ( ) => {
76
+ socket . on ( "backlog" , handleEpicEvent ) ;
61
77
inputElementRef . current ?. focus ( ) ;
78
+
79
+ return ( ) => {
80
+ socket . off ( "backlog" , handleEpicEvent ) ;
81
+ } ;
62
82
} , [ ] ) ;
63
83
64
84
return (
You can’t perform that action at this time.
0 commit comments