Resolve: store repost's original channel too

## Issue
- Closes "1535 bunch of channels (from featured?) resolved on page load"
- It was due to the use of reposts in the Category. As we did not store the repost's original channel claim, `ChannelThumbnail` couldn't find the author and requested a separate `resolve`.

## Change
Store the repost's original channel claim as well.
This commit is contained in:
infinite-persistence 2022-05-26 16:54:45 +08:00 committed by Thomas Zarebczan
parent 11bdb6a872
commit 3ed05e62a5

View file

@ -212,6 +212,7 @@ function handleClaimAction(state: State, action: any): State {
// $FlowFixMe
const { claimsInChannel, stream, channel: channelFromResolve, collection } = resolveResponse;
const channel = channelFromResolve || (stream && stream.signing_channel);
const repostSrcChannel = stream && stream.reposted_claim ? stream.reposted_claim.signing_channel : null;
if (stream) {
if (pendingById[stream.claim_id]) {
@ -257,6 +258,12 @@ function handleClaimAction(state: State, action: any): State {
newResolvingUrls.delete(channel.permanent_url);
}
if (repostSrcChannel && repostSrcChannel.claim_id) {
updateIfClaimChanged(state.byId, byIdDelta, repostSrcChannel.claim_id, repostSrcChannel);
updateIfValueChanged(state.claimsByUri, byUriDelta, repostSrcChannel.permanent_url, repostSrcChannel.claim_id);
updateIfValueChanged(state.claimsByUri, byUriDelta, repostSrcChannel.canonical_url, repostSrcChannel.claim_id);
}
if (collection) {
if (pendingById[collection.claim_id]) {
byIdDelta[collection.claim_id] = mergeClaim(collection, state.byId[collection.claim_id]);