Make FileTile resolve URIs (fixes exact search matching)
This commit is contained in:
parent
c0053363ff
commit
84b86ff8e4
4 changed files with 28 additions and 17 deletions
|
@ -146,12 +146,6 @@ export function doFetchFeaturedUris() {
|
|||
uris: featuredUris,
|
||||
}
|
||||
})
|
||||
|
||||
Object.keys(Uris).forEach((category) => {
|
||||
Uris[category].forEach((uri) => {
|
||||
dispatch(doResolveUri(lbryuri.normalize(uri)))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const failure = () => {
|
||||
|
|
|
@ -8,20 +8,30 @@ import {
|
|||
import {
|
||||
makeSelectFileInfoForUri,
|
||||
} from 'selectors/file_info'
|
||||
import {
|
||||
makeSelectResolvingUri,
|
||||
} from 'selectors/content'
|
||||
import {
|
||||
doResolveUri,
|
||||
} from 'actions/content'
|
||||
import FileTile from './view'
|
||||
|
||||
const makeSelect = () => {
|
||||
const selectClaimForUri = makeSelectClaimForUri()
|
||||
const selectFileInfoForUri = makeSelectFileInfoForUri()
|
||||
const selectResolvingUri = makeSelectResolvingUri()
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: selectClaimForUri(state, props),
|
||||
fileInfo: selectFileInfoForUri(state, props),
|
||||
resolvingUri: selectResolvingUri(state, props),
|
||||
})
|
||||
|
||||
return select
|
||||
}
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
})
|
||||
|
||||
export default connect(makeSelect, perform)(FileTile)
|
||||
|
|
|
@ -7,24 +7,31 @@ import FileTileStream from 'component/fileTileStream'
|
|||
import FileActions from 'component/fileActions';
|
||||
|
||||
class FileTile extends React.Component {
|
||||
componentDidMount() {
|
||||
const {
|
||||
resolvingUri,
|
||||
resolveUri,
|
||||
claim,
|
||||
uri,
|
||||
} = this.props
|
||||
|
||||
if(!resolvingUri && !claim) {
|
||||
resolveUri(uri)
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
displayStyle,
|
||||
uri,
|
||||
claim,
|
||||
resolvingUri,
|
||||
resolveUri,
|
||||
} = this.props
|
||||
|
||||
if(!claim) {
|
||||
if (displayStyle == 'card') {
|
||||
return <FileCardStream uri={uri} />
|
||||
}
|
||||
return null
|
||||
}
|
||||
if (displayStyle == 'card') return <FileCardStream uri={uri} />
|
||||
|
||||
return displayStyle == 'card' ?
|
||||
<FileCardStream uri={uri} />
|
||||
:
|
||||
<FileTileStream uri={uri} key={uri} />
|
||||
return <FileTileStream uri={uri} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ const SearchPage = (props) => {
|
|||
Exact URL
|
||||
<ToolTip label="?" body="This is the resolution of a LBRY URL and not controlled by LBRY Inc." className="tooltip--header" />
|
||||
</h3>
|
||||
<FileTile uri={query} showEmpty={true} />
|
||||
<FileTile uri={lbryuri.normalize(query)} showEmpty={true} />
|
||||
</section> : '' }
|
||||
<section className="section-spaced">
|
||||
<h3 className="card-row__header">
|
||||
|
|
Loading…
Reference in a new issue