Merge pull request #241 from lbryio/refresh-claim-list-mine
Always refresh claims/file info on downloaded/published pages
This commit is contained in:
commit
be198e0cf4
6 changed files with 20 additions and 36 deletions
|
@ -98,16 +98,9 @@ export function doDeleteFile(outpoint, deleteFromComputer) {
|
|||
|
||||
export function doFetchFileInfosAndPublishedClaims() {
|
||||
return function(dispatch, getState) {
|
||||
const state = getState(),
|
||||
isClaimListMinePending = selectClaimListMineIsPending(state),
|
||||
isFileInfoListPending = selectFileListIsPending(state);
|
||||
const state = getState();
|
||||
|
||||
if (isClaimListMinePending === undefined) {
|
||||
dispatch(doFetchClaimListMine());
|
||||
}
|
||||
|
||||
if (isFileInfoListPending === undefined) {
|
||||
dispatch(doFileList());
|
||||
}
|
||||
dispatch(doFetchClaimListMine());
|
||||
dispatch(doFileList());
|
||||
};
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class FileList extends React.PureComponent {
|
|||
});
|
||||
return (
|
||||
<section className="file-list__header">
|
||||
{fetching && <span className="busy-indicator" />}
|
||||
{fetching && <BusyMessage />}
|
||||
<span className="sort-section">
|
||||
{__("Sort by")} {" "}
|
||||
<FormField type="select" onChange={this.handleSortChanged.bind(this)}>
|
||||
|
|
|
@ -19,14 +19,14 @@ class FileTile extends React.PureComponent {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.resolve(this.props);
|
||||
const { isResolvingUri, claim, uri, resolveUri } = this.props;
|
||||
|
||||
if (!isResolvingUri && !claim && uri) resolveUri(uri);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.resolve(nextProps);
|
||||
}
|
||||
const { isResolvingUri, claim, uri, resolveUri } = this.props;
|
||||
|
||||
resolve({ isResolvingUri, claim, uri, resolveUri }) {
|
||||
if (!isResolvingUri && claim === undefined && uri) resolveUri(uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ lbry.file_list = function(params = {}) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apiCall(
|
||||
"file_list",
|
||||
params,
|
||||
|
@ -458,30 +458,21 @@ lbry.claim_list_mine = function(params = {}) {
|
|||
});
|
||||
};
|
||||
|
||||
const claimCacheKey = "resolve_claim_cache";
|
||||
lbry._claimCache = getSession(claimCacheKey, {});
|
||||
|
||||
lbry._resolveXhrs = {};
|
||||
lbry.resolve = function(params = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!params.uri) {
|
||||
throw __("Resolve has hacked cache on top of it that requires a URI");
|
||||
}
|
||||
if (params.uri && lbry._claimCache[params.uri] !== undefined) {
|
||||
resolve(lbry._claimCache[params.uri]);
|
||||
} else {
|
||||
lbry._resolveXhrs[params.uri] = apiCall(
|
||||
"resolve",
|
||||
params,
|
||||
data => {
|
||||
if (data !== undefined) {
|
||||
lbry._claimCache[params.uri] = data;
|
||||
}
|
||||
setSession(claimCacheKey, lbry._claimCache);
|
||||
resolve(data && data[params.uri] ? data[params.uri] : {});
|
||||
},
|
||||
reject
|
||||
);
|
||||
}
|
||||
lbry._resolveXhrs[params.uri] = apiCall(
|
||||
"resolve",
|
||||
params,
|
||||
function(data) {
|
||||
resolve(data && data[params.uri] ? data[params.uri] : {});
|
||||
},
|
||||
reject
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import SubHeader from "component/subHeader";
|
|||
|
||||
class FileListDownloaded extends React.PureComponent {
|
||||
componentWillMount() {
|
||||
this.props.fetchFileInfosDownloaded();
|
||||
if (!this.props.isPending) this.props.fetchFileInfosDownloaded();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -12,7 +12,7 @@ import SubHeader from "component/subHeader";
|
|||
|
||||
class FileListPublished extends React.PureComponent {
|
||||
componentWillMount() {
|
||||
this.props.fetchFileListPublished();
|
||||
if (!this.props.isPending) this.props.fetchFileListPublished();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
|
Loading…
Add table
Reference in a new issue