Fix livestream date incorrect if short url is used
## Issue - "https://odysee.com/LIVE:6dd" yields "Live 3 months ago" (incorrect) - "https://odysee.com/@RekietaLaw:a/LIVE:6dd" yields "Live 30 minutes ago" (correct) ## Approach Use claim ID instead of uri when searching `activeLivestreams`
This commit is contained in:
parent
a636d7d8c9
commit
88907901a1
2 changed files with 9 additions and 9 deletions
|
@ -1,13 +1,13 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||||
|
import { selectActiveLivestreamForClaimId } from 'redux/selectors/livestream';
|
||||||
import LivestreamDateTime from './view';
|
import LivestreamDateTime from './view';
|
||||||
import { selectActiveLivestreamForUri } from 'redux/selectors/livestream';
|
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||||
return {
|
return {
|
||||||
claim,
|
claim,
|
||||||
activeLivestream: selectActiveLivestreamForUri(state, props.uri),
|
activeLivestream: selectActiveLivestreamForClaimId(state, claim?.claim_id),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,19 +62,19 @@ export const selectIsActiveLivestreamForUri = createCachedSelector(
|
||||||
}
|
}
|
||||||
)((state, uri) => String(uri));
|
)((state, uri) => String(uri));
|
||||||
|
|
||||||
export const selectActiveLivestreamForUri = createCachedSelector(
|
export const selectActiveLivestreamForClaimId = createCachedSelector(
|
||||||
(state, uri) => uri,
|
(state, claimId) => claimId,
|
||||||
selectActiveLivestreams,
|
selectActiveLivestreams,
|
||||||
(uri, activeLivestreams) => {
|
(claimId, activeLivestreams) => {
|
||||||
if (!uri || !activeLivestreams) {
|
if (!claimId || !activeLivestreams) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeLivestreamValues = Object.values(activeLivestreams);
|
const activeLivestreamValues = Object.values(activeLivestreams);
|
||||||
// $FlowFixMe - unable to resolve claimUri
|
// $FlowFixMe - https://github.com/facebook/flow/issues/2221
|
||||||
return activeLivestreamValues.find((v) => v.claimUri === uri) || null;
|
return activeLivestreamValues.find((v) => v.claimId === claimId) || null;
|
||||||
}
|
}
|
||||||
)((state, uri) => String(uri));
|
)((state, claimId) => String(claimId));
|
||||||
|
|
||||||
export const selectActiveLivestreamForChannel = createCachedSelector(
|
export const selectActiveLivestreamForChannel = createCachedSelector(
|
||||||
(state, channelId) => channelId,
|
(state, channelId) => channelId,
|
||||||
|
|
Loading…
Reference in a new issue