Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1717cb6

Browse files
committed
Reduce UI flicker
1 parent 2250ab8 commit 1717cb6

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/app/Store.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ function clear(servers: Map<string, IMonitor | IProxy>, data: any) {
3434
}
3535

3636
export default class Store {
37+
@observable public isLoading: boolean = true
3738
@observable public selectedMonitorId: string = ''
3839
@observable public monitors: Map<string, IMonitor> = new Map()
3940
@observable public proxies: Map<string, IProxy> = new Map()
40-
@observable public servers: Map<string, IMonitor | IProxy> = new Map()
4141

4242
constructor() {
4343
this.watchServers()
@@ -71,6 +71,9 @@ export default class Store {
7171
}
7272
}
7373
})
74+
75+
// Initial data has been loaded
76+
this.isLoading = false
7477
})
7578
}
7679

src/app/components/Nav/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ header {
1717
flex: 1;
1818
}
1919

20+
.menu.hidden {
21+
visibility: hidden;
22+
}
23+
2024
footer {
2125
padding: 1rem;
2226
}

src/app/components/Nav/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export interface IProps {
1515
}
1616

1717
function Nav({ store }: IProps) {
18-
const { selectedMonitorId, monitors, proxies } = store
18+
const { isLoading, selectedMonitorId, monitors, proxies } = store
1919
return (
2020
<div className="nav">
2121
<header>hotel</header>
22-
<div className="menu">
22+
<div className={classNames('menu', { hidden: isLoading })}>
2323
{monitors.size === 0 &&
2424
proxies.size === 0 && (
2525
<div>

0 commit comments

Comments
 (0)