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",
"json-loader": "^0.5.4",
"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",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

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

View file

@ -255,15 +255,20 @@ function ClaimListDiscover(props: Props) {
const hasMatureTags = tagsParam && tagsParam.split(',').some(t => MATURE_TAGS.includes(t));
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];
const claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
const shouldPerformSearch =
uris.length === 0 ||
claimSearchResult === undefined ||
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
const optionsStringForEffect = JSON.stringify(options);
const noResults = (
const timedOutMessage = (
<div>
<p>
<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>
</p>
<p>
@ -587,14 +592,14 @@ function ClaimListDiscover(props: Props) {
<ClaimList
id={claimSearchCacheQuery}
loading={loading}
uris={uris}
uris={claimSearchResult}
header={header || defaultHeader}
headerLabel={headerLabel}
headerAltControls={meta}
onScrollBottom={handleScrollBottom}
page={page}
pageSize={CS.PAGE_SIZE}
empty={noResults}
timedOutMessage={timedOutMessage}
renderProperties={renderProperties}
includeSupportAction={includeSupportAction}
hideBlock={hideBlock}

View file

@ -6138,9 +6138,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#6c0436cf140d2cc839f32ce1a780fc2068d55b85:
lbry-redux@lbryio/lbry-redux#b7ae238606587696f92718120a646a5965ee8ae9:
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:
proxy-polyfill "0.1.6"
reselect "^3.0.0"