Revert "Recsys: determine the clicked index based on raw results instead of rendered order"

This reverts commit e4214b1c1b.
This commit is contained in:
Thomas Zarebczan 2022-06-01 09:55:38 -04:00
parent 6ee3b34b10
commit b6eb580c82
3 changed files with 6 additions and 10 deletions

View file

@ -1,7 +1,7 @@
// @flow
import { RECSYS_ENDPOINT } from 'config';
import { selectUser } from 'redux/selectors/user';
import { makeSelectRecommendedRecsysIdForClaimId, selectRecommendedContentRawForUri } from 'redux/selectors/search';
import { makeSelectRecommendedRecsysIdForClaimId } from 'redux/selectors/search';
import { v4 as Uuidv4 } from 'uuid';
import { parseURI } from 'util/lbryURI';
import { getAuthToken } from 'util/saved-passwords';
@ -82,17 +82,13 @@ const recsys: Recsys = {
* plus recommended content, recsysId, etc.
* Called from recommendedContent component
*/
onRecsLoaded: function (uri, claimId, uuid = '') {
onRecsLoaded: function (claimId, uris, uuid = '') {
if (window && window.store) {
const state = window.store.getState();
const rawRecommendations = selectRecommendedContentRawForUri(state, uri);
const rawUris = rawRecommendations ? rawRecommendations.uris : null;
if (!recsys.entries[claimId]) {
recsys.createRecsysEntry(claimId, null, uuid);
}
const claimIds = getClaimIdsFromUris(rawUris);
const claimIds = getClaimIdsFromUris(uris);
recsys.entries[claimId]['recsysId'] = makeSelectRecommendedRecsysIdForClaimId(claimId)(state) || recsysId;
recsys.entries[claimId]['pageLoadedAt'] = Date.now();

View file

@ -4,7 +4,7 @@ declare type Recsys = {
saveEntries: () => void,
onClickedRecommended: (parentClaimId: ClaimId, newClaimId: ClaimId) => void,
onRecsLoaded: (uri: ?string, claimId: ClaimId, uuid: string) => void,
onRecsLoaded: (claimId: ClaimId, uris: Array<string>, uuid: string) => void,
createRecsysEntry: (claimId: ClaimId, parentUuid?: ?string, uuid?: string) => void,
sendRecsysEntry: (claimId: ClaimId, isTentative?: boolean) => ?Promise<?Response>,
sendEntries: (entries: ?{ [ClaimId]: RecsysEntry }, isResumedSend: boolean) => void,

View file

@ -107,9 +107,9 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
nextRecommendedUri &&
viewMode === VIEW_ALL_RELATED
) {
onRecommendationsLoaded(uri, claimId, uuid);
onRecommendationsLoaded(claimId, recommendedContentUris, uuid);
}
}, [uri, recommendedContentUris, onRecommendationsLoaded, claimId, nextRecommendedUri, viewMode, uuid]);
}, [recommendedContentUris, onRecommendationsLoaded, claimId, nextRecommendedUri, viewMode, uuid]);
function handleRecommendationClicked(e, clickedClaim) {
if (claim) {