only show timed out message when claim_search times out

This commit is contained in:
Sean Yesmunt 2020-03-31 12:07:57 -04:00
parent 88d78f117b
commit 25bf9290e1
5 changed files with 24 additions and 14 deletions

View file

@ -130,7 +130,7 @@
"imagesloaded": "^4.1.4", "imagesloaded": "^4.1.4",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#6c0436cf140d2cc839f32ce1a780fc2068d55b85", "lbry-redux": "lbryio/lbry-redux#b7ae238606587696f92718120a646a5965ee8ae9",
"lbryinc": "lbryio/lbryinc#19260fac560daaa4be2d4af372f28109ea96ebf9", "lbryinc": "lbryio/lbryinc#19260fac560daaa4be2d4af372f28109ea96ebf9",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",

View file

@ -999,7 +999,7 @@
"Short": "Short", "Short": "Short",
"How Fresh": "How Fresh", "How Fresh": "How Fresh",
"This Default": "This Default", "This Default": "This Default",
"Sorry, your request returned no results or timed out. Modify your options or %again%": "Sorry, your request returned no results or timed out. Modify your options or %again%", "Sorry, your request timed out. Modify your options or %again%": "Sorry, your request timed out. Modify your options or %again%",
"Image": "Image", "Image": "Image",
"Model": "Model", "Model": "Model",
"Binary": "Binary", "Binary": "Binary",
@ -1085,5 +1085,6 @@
"Finnish": "Finnish", "Finnish": "Finnish",
"Kannada": "Kannada", "Kannada": "Kannada",
"Transcoding this %size%MB file should take under %processTime% %units%.": "Transcoding this %size%MB file should take under %processTime% %units%.", "Transcoding this %size%MB file should take under %processTime% %units%.": "Transcoding this %size%MB file should take under %processTime% %units%.",
"FFmpeg not configured. More in %settings_link%.": "FFmpeg not configured. More in %settings_link%." "FFmpeg not configured. More in %settings_link%.": "FFmpeg not configured. More in %settings_link%.",
} "smallresult": "smallresult"
}

View file

@ -32,6 +32,7 @@ type Props = {
includeSupportAction?: boolean, includeSupportAction?: boolean,
hideBlock: boolean, hideBlock: boolean,
injectedItem: ?Node, injectedItem: ?Node,
timedOutMessage?: Node,
}; };
export default function ClaimList(props: Props) { export default function ClaimList(props: Props) {
@ -55,9 +56,11 @@ export default function ClaimList(props: Props) {
includeSupportAction, includeSupportAction,
hideBlock, hideBlock,
injectedItem, injectedItem,
timedOutMessage,
} = props; } = props;
const [scrollBottomCbMap, setScrollBottomCbMap] = useState({}); const [scrollBottomCbMap, setScrollBottomCbMap] = useState({});
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
const timedOut = uris === null;
const urisLength = (uris && uris.length) || 0; const urisLength = (uris && uris.length) || 0;
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || []; const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];
@ -157,9 +160,10 @@ export default function ClaimList(props: Props) {
))} ))}
</ul> </ul>
)} )}
{urisLength === 0 && !loading && ( {!timedOut && urisLength === 0 && !loading && (
<div className="card--section main--empty empty">{empty || __('No results')}</div> <div className="card--section main--empty empty">{empty || __('No results')}</div>
)} )}
{timedOut && timedOutMessage && <div className="card--section main--empty empty">{timedOutMessage}</div>}
</section> </section>
); );
} }

View file

@ -255,15 +255,20 @@ function ClaimListDiscover(props: Props) {
const hasMatureTags = tagsParam && tagsParam.split(',').some(t => MATURE_TAGS.includes(t)); const hasMatureTags = tagsParam && tagsParam.split(',').some(t => MATURE_TAGS.includes(t));
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options); const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || []; const claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
const shouldPerformSearch = const shouldPerformSearch =
uris.length === 0 || claimSearchResult === undefined ||
didNavigateForward || didNavigateForward ||
(!loading && uris.length < CS.PAGE_SIZE * page && uris.length % CS.PAGE_SIZE === 0); (!loading &&
claimSearchResult &&
claimSearchResult.length < CS.PAGE_SIZE * page &&
claimSearchResult.length % CS.PAGE_SIZE === 0);
// Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time // Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time
const optionsStringForEffect = JSON.stringify(options); const optionsStringForEffect = JSON.stringify(options);
const noResults = ( const timedOutMessage = (
<div> <div>
<p> <p>
<I18nMessage <I18nMessage
@ -277,7 +282,7 @@ function ClaimListDiscover(props: Props) {
), ),
}} }}
> >
Sorry, your request returned no results or timed out. Modify your options or %again% Sorry, your request timed out. Modify your options or %again%
</I18nMessage> </I18nMessage>
</p> </p>
<p> <p>
@ -587,14 +592,14 @@ function ClaimListDiscover(props: Props) {
<ClaimList <ClaimList
id={claimSearchCacheQuery} id={claimSearchCacheQuery}
loading={loading} loading={loading}
uris={uris} uris={claimSearchResult}
header={header || defaultHeader} header={header || defaultHeader}
headerLabel={headerLabel} headerLabel={headerLabel}
headerAltControls={meta} headerAltControls={meta}
onScrollBottom={handleScrollBottom} onScrollBottom={handleScrollBottom}
page={page} page={page}
pageSize={CS.PAGE_SIZE} pageSize={CS.PAGE_SIZE}
empty={noResults} timedOutMessage={timedOutMessage}
renderProperties={renderProperties} renderProperties={renderProperties}
includeSupportAction={includeSupportAction} includeSupportAction={includeSupportAction}
hideBlock={hideBlock} hideBlock={hideBlock}

View file

@ -6138,9 +6138,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#6c0436cf140d2cc839f32ce1a780fc2068d55b85: lbry-redux@lbryio/lbry-redux#b7ae238606587696f92718120a646a5965ee8ae9:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/6c0436cf140d2cc839f32ce1a780fc2068d55b85" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/b7ae238606587696f92718120a646a5965ee8ae9"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"