File tree 2 files changed +13
-9
lines changed
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,13 @@ export const SlotItem: React.FC<SlotItemProps> = ({
37
37
const [ isOptionsOpen , setIsOptionsOpen ] = useState ( false )
38
38
39
39
const onPressAdd = useCallback ( async ( ) => {
40
- await ncoState ?. set ( 'status' , 'loading' )
41
-
42
40
await ncoState ?. add ( 'slotDetails' , {
43
41
...detail ,
44
42
status : 'loading' ,
45
43
} )
46
44
45
+ await ncoState ?. set ( 'status' , 'loading' )
46
+
47
47
const { id } = detail
48
48
49
49
const [ comment ] = await getNiconicoComments ( [ { contentId : id } ] )
@@ -83,10 +83,14 @@ export const SlotItem: React.FC<SlotItemProps> = ({
83
83
} , [ detail ] )
84
84
85
85
const onPressRemove = useCallback ( async ( ) => {
86
+ await ncoState ?. set ( 'status' , 'loading' )
87
+
86
88
const { id } = detail
87
89
88
90
await ncoState ?. remove ( 'slotDetails' , { id } )
89
91
await ncoState ?. remove ( 'slots' , { id } )
92
+
93
+ await ncoState ?. set ( 'status' , 'ready' )
90
94
} , [ detail . id ] )
91
95
92
96
return (
Original file line number Diff line number Diff line change @@ -93,13 +93,15 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
93
93
const onAdd = useCallback ( async ( ) => {
94
94
if ( ! slotDetail ) return
95
95
96
- await ncoState ?. set ( 'status' , 'loading' )
97
-
98
96
await ncoState ?. add ( 'slotDetails' , {
99
97
...slotDetail ,
100
98
status : 'loading' ,
101
99
} )
102
100
101
+ await ncoState ?. set ( 'status' , 'loading' )
102
+
103
+ const { id } = slotDetail
104
+
103
105
const [ comment ] = await getJikkyoKakologs ( [
104
106
{
105
107
jkChId : jkChId ! ,
@@ -112,7 +114,7 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
112
114
const { thread, markers } = comment
113
115
114
116
await ncoState ?. update ( 'slotDetails' , [ 'id' ] , {
115
- id : thread . id as string ,
117
+ id,
116
118
status : 'ready' ,
117
119
markers,
118
120
info : {
@@ -123,13 +125,11 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
123
125
} )
124
126
125
127
await ncoState ?. add ( 'slots' , {
126
- id : thread . id as string ,
128
+ id,
127
129
threads : [ thread ] ,
128
130
} )
129
131
} else {
130
- await ncoState ?. remove ( 'slotDetails' , {
131
- id : slotDetail . id ,
132
- } )
132
+ await ncoState ?. remove ( 'slotDetails' , { id } )
133
133
}
134
134
135
135
await ncoState ?. set ( 'status' , 'ready' )
You can’t perform that action at this time.
0 commit comments