Skip to content

Commit 935c2f2

Browse files
committed
バッジに反映されるように
1 parent 407ecc2 commit 935c2f2

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/components/slot-item/index.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ export const SlotItem: React.FC<SlotItemProps> = ({
3737
const [isOptionsOpen, setIsOptionsOpen] = useState(false)
3838

3939
const onPressAdd = useCallback(async () => {
40-
await ncoState?.set('status', 'loading')
41-
4240
await ncoState?.add('slotDetails', {
4341
...detail,
4442
status: 'loading',
4543
})
4644

45+
await ncoState?.set('status', 'loading')
46+
4747
const { id } = detail
4848

4949
const [comment] = await getNiconicoComments([{ contentId: id }])
@@ -83,10 +83,14 @@ export const SlotItem: React.FC<SlotItemProps> = ({
8383
}, [detail])
8484

8585
const onPressRemove = useCallback(async () => {
86+
await ncoState?.set('status', 'loading')
87+
8688
const { id } = detail
8789

8890
await ncoState?.remove('slotDetails', { id })
8991
await ncoState?.remove('slots', { id })
92+
93+
await ncoState?.set('status', 'ready')
9094
}, [detail.id])
9195

9296
return (

src/entrypoints/popup/SidePane/JikkyoSelector.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
9393
const onAdd = useCallback(async () => {
9494
if (!slotDetail) return
9595

96-
await ncoState?.set('status', 'loading')
97-
9896
await ncoState?.add('slotDetails', {
9997
...slotDetail,
10098
status: 'loading',
10199
})
102100

101+
await ncoState?.set('status', 'loading')
102+
103+
const { id } = slotDetail
104+
103105
const [comment] = await getJikkyoKakologs([
104106
{
105107
jkChId: jkChId!,
@@ -112,7 +114,7 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
112114
const { thread, markers } = comment
113115

114116
await ncoState?.update('slotDetails', ['id'], {
115-
id: thread.id as string,
117+
id,
116118
status: 'ready',
117119
markers,
118120
info: {
@@ -123,13 +125,11 @@ export const JikkyoSelector: React.FC<JikkyoSelectorProps> = ({
123125
})
124126

125127
await ncoState?.add('slots', {
126-
id: thread.id as string,
128+
id,
127129
threads: [thread],
128130
})
129131
} else {
130-
await ncoState?.remove('slotDetails', {
131-
id: slotDetail.id,
132-
})
132+
await ncoState?.remove('slotDetails', { id })
133133
}
134134

135135
await ncoState?.set('status', 'ready')

0 commit comments

Comments
 (0)