perf(top): fix unnecessary drawing on top page
This commit is contained in:
10
src/app/LinearProgress.js
Normal file
10
src/app/LinearProgress.js
Normal file
@ -0,0 +1,10 @@
|
||||
import LinearProgressOriginal from 'material-ui/LinearProgress';
|
||||
|
||||
export default class LinearProgress extends LinearProgressOriginal
|
||||
{
|
||||
barUpdate(id, ...args)
|
||||
{
|
||||
super.barUpdate(id, ...args)
|
||||
return this.timers[id]
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import TorrentLine from './torrent'
|
||||
import {List, ListItem} from 'material-ui/List';
|
||||
import Subheader from 'material-ui/Subheader';
|
||||
import Divider from 'material-ui/Divider';
|
||||
import LinearProgress from 'material-ui/LinearProgress';
|
||||
import LinearProgress from './LinearProgress';
|
||||
|
||||
export default class SearchResults extends Component {
|
||||
render() {
|
||||
|
@ -6,7 +6,7 @@ import {List, ListItem} from 'material-ui/List';
|
||||
import Divider from 'material-ui/Divider';
|
||||
import Subheader from 'material-ui/Subheader';
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import LinearProgress from 'material-ui/LinearProgress';
|
||||
import LinearProgress from './LinearProgress';
|
||||
|
||||
import {Tabs, Tab} from 'material-ui/Tabs';
|
||||
import _ from 'lodash'
|
||||
@ -150,6 +150,12 @@ export default class TopPage extends Page {
|
||||
Object.keys(this.times).map((time, index) => {
|
||||
const {torrents} = this.topTorrents[type][time] || {torrents: undefined};
|
||||
|
||||
// dont draw top on other page rather than focused
|
||||
if(this.state.type !== type || this.state.time !== time)
|
||||
{
|
||||
return <Tab buttonStyle={time === this.state.time ? {fontWeight: 'bold'} : undefined} style={{minWidth: 150}} key={index} label={this.times[time]} value={time}></Tab>
|
||||
}
|
||||
|
||||
if(!torrents)
|
||||
return (
|
||||
<Tab buttonStyle={time === this.state.time ? {fontWeight: 'bold'} : undefined} style={{minWidth: 150}} key={index} label={this.times[time]} value={time}>
|
||||
|
@ -14,7 +14,7 @@ import NoImage from './images/no-image-icon.png'
|
||||
var moment = require('moment');
|
||||
import RefreshIndicator from 'material-ui/RefreshIndicator';
|
||||
let rating = require('./rating');
|
||||
import LinearProgress from 'material-ui/LinearProgress';
|
||||
import LinearProgress from './LinearProgress';
|
||||
import FlatButton from 'material-ui/FlatButton';
|
||||
import {fileTypeDetect} from './content'
|
||||
import {contentIcon} from './torrent'
|
||||
|
@ -7,7 +7,7 @@ import ToolTip from './tooltip';
|
||||
import PagesPie from './pages-pie.js';
|
||||
import TorrentPage from './torrent-page'
|
||||
|
||||
import LinearProgress from 'material-ui/LinearProgress';
|
||||
import LinearProgress from './LinearProgress';
|
||||
let rating = require('./rating');
|
||||
import scrollBack from './remember-scroll'
|
||||
import TrackersImages from './trackers-images'
|
||||
|
Reference in New Issue
Block a user