Skip to content

Commit 81f8cb6

Browse files
authored
[UI] Update library when changing games' categories (#4829)
* [UI] Update library when changing games' categories * Refactor: change customCategories reference only
1 parent 35966c3 commit 81f8cb6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/frontend/state/GlobalState.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,13 @@ class GlobalState extends PureComponent<Props> {
395395
}
396396

397397
addGameToCustomCategory = (category: string, appName: string) => {
398-
const newCustomCategories = this.state.customCategories
399-
400-
if (!newCustomCategories[category]) newCustomCategories[category] = []
398+
const gamesInCategory = this.state.customCategories[category] || []
399+
gamesInCategory.push(appName)
401400

402-
newCustomCategories[category].push(appName)
401+
const newCustomCategories = {
402+
...this.state.customCategories,
403+
[category]: gamesInCategory
404+
}
403405

404406
this.setState({
405407
customCategories: newCustomCategories

0 commit comments

Comments
 (0)