Skip to content

Commit 8cac1ce

Browse files
committed
fix: battle popup caching issue
1 parent 9e944c0 commit 8cac1ce

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/features/station/StationTile.jsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,30 @@ function compareValueOrFalsy(prev, next) {
9292
return prev === next || (!prev && !next)
9393
}
9494

95+
const trackedBattleKeys = [
96+
'battle_level',
97+
'battle_pokemon_id',
98+
'battle_pokemon_form',
99+
'battle_pokemon_costume',
100+
'battle_pokemon_gender',
101+
'battle_pokemon_alignment',
102+
'battle_pokemon_bread_mode',
103+
'battle_start',
104+
'battle_end',
105+
'is_battle_available',
106+
'total_stationed_pokemon',
107+
'total_stationed_gmax',
108+
'updated',
109+
]
110+
95111
export const StationTile = React.memo(
96112
BaseStationTile,
97113
(prev, next) =>
98114
prev.id === next.id &&
99-
compareValueOrFalsy(prev.battle_level, next.battle_level) &&
100-
compareValueOrFalsy(prev.battle_pokemon_id, next.battle_pokemon_id) &&
101-
prev.start_time === next.start_time &&
102-
prev.end_time === next.end_time,
115+
prev.name === next.name &&
116+
compareValueOrFalsy(prev.lat, next.lat) &&
117+
compareValueOrFalsy(prev.lon, next.lon) &&
118+
compareValueOrFalsy(prev.start_time, next.start_time) &&
119+
compareValueOrFalsy(prev.end_time, next.end_time) &&
120+
trackedBattleKeys.every((key) => compareValueOrFalsy(prev[key], next[key])),
103121
)

0 commit comments

Comments
 (0)