fix(top): fix top tab redraw bug regression in v0.29.3

This commit is contained in:
Alexey Kasyanchuk
2018-08-29 01:41:28 +03:00
parent 0fe31cbb6e
commit 7bb61e100f
2 changed files with 33 additions and 20 deletions

View File

@ -12,26 +12,35 @@ class PagesPie extends Component {
if (params.replace === 'last') { if (params.replace === 'last') {
this.pie.pop(); this.pie.pop();
} }
this.forceUpdate();
delete params.replace; delete params.replace;
} }
setTimeout(() => { if (Array.isArray(pages)) {
if (Array.isArray(pages)) { for (let i in pages) {
for (let i in pages) { this.pie.push({
this.pie.push({ Page: pages[i],
Page: pages[i], params: params
params: params });
}); }
} } else {
} else { this.pie.push({
this.pie.push({ Page: pages,
Page: pages, params: params
params: params });
}); }
} if(this._mounted)
this.forceUpdate(); this.forceUpdate()
}, 0); }
}
componentWillMount()
{
this._mounted = true
}
componentWillUnmount()
{
this._mounted = false
}
close(count) { close(count) {
if (count && typeof count === 'number') { if (count && typeof count === 'number') {
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
@ -50,7 +59,7 @@ class PagesPie extends Component {
} }
// ОТРИСОВКА // ОТРИСОВКА
render() { render() {
if (this.pie.length > 0) { if (this.pie.length > 0) {
return ( return (
<div <div
className={'pie full-size ' + (this.props.className || '')} className={'pie full-size ' + (this.props.className || '')}

View File

@ -50,8 +50,12 @@ export default class TopPage extends Page {
} }
mergeTorrents(torrents, type, time) mergeTorrents(torrents, type, time)
{ {
let isNewTab = false
if(!this.topTorrents[type]) if(!this.topTorrents[type])
{
this.topTorrents[type] = {} this.topTorrents[type] = {}
isNewTab = true
}
if(!this.topTorrents[type][time]) if(!this.topTorrents[type][time])
this.topTorrents[type][time] = {torrents: [], page: 0} this.topTorrents[type][time] = {torrents: [], page: 0}
@ -60,7 +64,7 @@ export default class TopPage extends Page {
this.topTorrents[type][time].torrents = _.orderBy(_.unionBy(this.topTorrents[type][time].torrents, torrents, 'hash'), ['seeders'], ['desc']) this.topTorrents[type][time].torrents = _.orderBy(_.unionBy(this.topTorrents[type][time].torrents, torrents, 'hash'), ['seeders'], ['desc'])
if(this.state.type == type && this.state.time == time) if((this.state.type == type && this.state.time == time) || isNewTab)
{ {
this._update(); this._update();
} }