Skip to content

Commit 6d4e94c

Browse files
authored
Merge pull request #72 from 2skydev/dev
v0.0.15
2 parents 373bee4 + 32b21f7 commit 6d4e94c

File tree

8 files changed

+21
-13
lines changed

8 files changed

+21
-13
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const RANK_RANGE_IDS = [2, 13, 3, 1] as const
22

33
export const RANK_RANGE_ID_TO_LABEL_MAP = {
4-
2: '플레티넘+',
4+
2: '에메랄드+',
55
13: '다이아+',
66
3: '마스터+',
7-
1: '브실골',
7+
1: '브실골플',
88
} as const

src/renderer/src/hooks/listener/useChampionSelectSessionListener.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const useChampionSelectSessionListener = () => {
1414

1515
useEffect(() => {
1616
window.electron.subscribeLeague('champ-select/session', data => {
17+
if (!data?.gameId) return
18+
1719
const currentSummonerId = currentSummoner!.id
1820
const currentSummonerData = data.myTeam.find(
1921
player => player.summonerId === currentSummonerId,

src/renderer/src/hooks/listener/useCurrentSummonerListener.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect } from 'react'
22

3+
import deepEqual from 'fast-deep-equal'
34
import { useAtom } from 'jotai'
45

56
import {
@@ -12,11 +13,15 @@ const useCurrentSummonerListener = () => {
1213

1314
useEffect(() => {
1415
window.electron.subscribeLeague('summoner/current', async data => {
15-
if (data && data.summonerId !== currentSummoner?.id) {
16-
const result = await getCurrentSummoner({ preparedData: data })
17-
setCurrentSummoner(result)
18-
} else if (!data) {
16+
if (!data) {
1917
setCurrentSummoner(null)
18+
return
19+
}
20+
21+
const result = await getCurrentSummoner({ preparedData: data })
22+
23+
if (!deepEqual(result, currentSummoner)) {
24+
setCurrentSummoner(result)
2025
}
2126
})
2227
}, [])

src/renderer/src/hooks/listener/useAppStateListener.ts renamed to src/renderer/src/hooks/listener/useLeagueListener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const useLeagueListener = () => {
3535
window.electron.subscribeLeague('in-game', isInGame => {
3636
setLeague({
3737
...league,
38-
isReady: isInGame,
38+
isInGame,
3939
})
4040
})
4141
}

src/renderer/src/pages/_app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import NeedUpdateLaterNotification from '@renderer/features/update/NeedUpdateLat
66
import useChampionDetailPageAutoNavigate from '@renderer/hooks/autoNavigate/useChampionDetailPageAutoNavigate'
77
import useInGamePageAutoNavigate from '@renderer/hooks/autoNavigate/useInGamePageAutoNavigate'
88
import useTierListPageAutoNavigate from '@renderer/hooks/autoNavigate/useTierListPageAutoNavigate'
9-
import useAppStateListener from '@renderer/hooks/listener/useAppStateListener'
109
import useAppUpdateListener from '@renderer/hooks/listener/useAppUpdateListener'
1110
import useChampionSelectSessionListener from '@renderer/hooks/listener/useChampionSelectSessionListener'
1211
import useCurrentSummonerListener from '@renderer/hooks/listener/useCurrentSummonerListener'
12+
import useLeagueListener from '@renderer/hooks/listener/useLeagueListener'
1313
import { useUpdateContentModal } from '@renderer/hooks/useUpdateContentModal'
1414
import { InitGlobalStyled } from '@renderer/styles/init'
1515

@@ -23,7 +23,7 @@ const App = () => {
2323
useUpdateContentModal({ autoOpen: !isNoLayout })
2424

2525
// listeners
26-
useAppStateListener()
26+
useLeagueListener()
2727
useAppUpdateListener()
2828
useChampionSelectSessionListener()
2929
useCurrentSummonerListener()

src/renderer/src/stores/atoms/appUpdate.atom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { atom } from 'jotai'
22

33
export const appUpdateAtom = atom(
4-
async () => {
4+
(async () => {
55
return {
66
version: await window.electron.getVersion(),
77
status: await window.electron.getUpdaterStatus(),
88
}
9-
},
9+
})(),
1010
(_, set, value) => {
1111
set(appUpdateAtom, value)
1212
},

src/renderer/src/stores/atoms/config.atom.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { atom } from 'jotai'
22

33
import { ConfigStoreValues } from '@main/modules/config/stores/config.store'
44

5-
export const configAtom = atom(window.electron.getConfig, (_, __, update: ConfigStoreValues) => {
5+
export const configAtom = atom(window.electron.getConfig(), (_, set, update: ConfigStoreValues) => {
66
window.electron.setConfig(update)
7+
set(configAtom, update)
78
})

src/renderer/src/stores/atoms/currentSummoner.atom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const getCurrentSummoner = async (
3939
}
4040

4141
export const currentSummonerAtom = atom(
42-
() => getCurrentSummoner({ checkIsReady: true }),
42+
getCurrentSummoner({ checkIsReady: true }),
4343
(_, set, value) => {
4444
set(currentSummonerAtom, value)
4545
},

0 commit comments

Comments
 (0)