more bug fixes + optimizations
This commit is contained in:
parent
5605b10f54
commit
950f3183cf
5 changed files with 22 additions and 24 deletions
|
@ -92,7 +92,7 @@ class FileTile extends React.Component {
|
|||
|
||||
let description = ""
|
||||
if (isClaimed) {
|
||||
description = metadata.description
|
||||
description = metadata && metadata.description
|
||||
} else if (isResolvingUri) {
|
||||
description = "Loading..."
|
||||
} else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) {
|
||||
|
|
|
@ -32,9 +32,6 @@ class WatchLink extends React.Component {
|
|||
fileInfo,
|
||||
} = this.props
|
||||
|
||||
console.log('watch link render')
|
||||
console.log(fileInfo)
|
||||
|
||||
return (<div>
|
||||
<Link button={ button ? button : null }
|
||||
disabled={isLoading || !costInfo || costInfo.cost == undefined || fileInfo === undefined}
|
||||
|
|
|
@ -99,10 +99,18 @@ class WunderBar extends React.PureComponent {
|
|||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this._input.value = this.state.address;
|
||||
if (this._input && this._focusPending) {
|
||||
this._input.select();
|
||||
this._focusPending = false;
|
||||
if (this._input) {
|
||||
const start = this._input.selectionStart,
|
||||
end = this._input.selectionEnd;
|
||||
|
||||
this._input.value = this.state.address; //this causes cursor to go to end of input
|
||||
|
||||
this._input.setSelectionRange(start, end);
|
||||
|
||||
if (this._focusPending) {
|
||||
this._input.select();
|
||||
this._focusPending = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,25 +13,19 @@ const lbryio = {
|
|||
const CONNECTION_STRING = 'https://api.lbry.io/';
|
||||
const EXCHANGE_RATE_TIMEOUT = 20 * 60 * 1000;
|
||||
|
||||
lbryio._exchangePromise = null;
|
||||
lbryio._exchangeLastFetched = null;
|
||||
lbryio.getExchangeRates = function() {
|
||||
const cached = getSession('exchangeRateCache');
|
||||
if (!cached || Date.now() - cached.time > EXCHANGE_RATE_TIMEOUT) {
|
||||
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!cached || Date.now() - cached.time > EXCHANGE_RATE_TIMEOUT) {
|
||||
if (!lbryio._exchangeLastFetched || Date.now() - lbryio._exchangeLastFetched > EXCHANGE_RATE_TIMEOUT) {
|
||||
lbryio._exchangePromise = new Promise((resolve, reject) => {
|
||||
lbryio.call('lbc', 'exchange_rate', {}, 'get', true).then(({lbc_usd, lbc_btc, btc_usd}) => {
|
||||
const rates = {lbc_usd, lbc_btc, btc_usd};
|
||||
setSession('exchangeRateCache', {
|
||||
rates: rates,
|
||||
time: Date.now(),
|
||||
});
|
||||
resolve(rates);
|
||||
});
|
||||
} else {
|
||||
resolve(cached.rates);
|
||||
}
|
||||
});
|
||||
}).catch(reject);
|
||||
});
|
||||
lbryio._exchangeLastFetched = Date.now();
|
||||
}
|
||||
return lbryio._exchangePromise;
|
||||
}
|
||||
|
||||
lbryio.call = function(resource, action, params={}, method='get', evenIfDisabled=false) { // evenIfDisabled is just for development, when we may have some calls working and some not
|
||||
|
|
|
@ -57,7 +57,6 @@ class FilePage extends React.Component{
|
|||
|
||||
fetchFileInfo(props) {
|
||||
if (!props.fileInfo) {
|
||||
console.log('fetch file info')
|
||||
props.fetchFileInfo()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue