Skip to content

Commit 229c595

Browse files
committed
Remember Last Filter
1 parent a23c458 commit 229c595

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/state/GlobalState.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Update from '../components/UI/Update'
33
import { getGameInfo, getLegendaryConfig, legendary, notify } from '../helper'
44
import { Game, GameStatus } from '../types'
55
import ContextProvider from './ContextProvider'
6+
const storage: Storage = window.localStorage
67
const { remote } = window.require('electron')
78
const { BrowserWindow } = remote
89

@@ -28,7 +29,7 @@ export class GlobalState extends PureComponent<Props> {
2829
libraryStatus: [],
2930
refreshing: false,
3031
error: false,
31-
filter: 'installed',
32+
filter: 'all',
3233
}
3334

3435
refresh = async (): Promise<void> => {
@@ -186,9 +187,15 @@ export class GlobalState extends PureComponent<Props> {
186187
}
187188

188189
componentDidMount() {
190+
const filter = storage.getItem('filter') || 'all'
191+
this.setState({ filter })
189192
this.refresh()
190193
}
191194

195+
componentDidUpdate() {
196+
storage.setItem('filter', this.state.filter)
197+
}
198+
192199
render() {
193200
const { children } = this.props
194201
const { data, filterText, filter, refreshing } = this.state

0 commit comments

Comments
 (0)