Merge pull request #48 from OdyseeTeam/ip/rescys

Handle recsys crash `new|me` fails
This commit is contained in:
Thomas Zarebczan 2021-10-11 12:57:20 -04:00 committed by GitHub
commit 3f969ae20d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,7 @@ const recsys = {
* Called from recommendedContent component * Called from recommendedContent component
*/ */
onRecsLoaded: function (claimId, uris) { onRecsLoaded: function (claimId, uris) {
if (window.store) { if (window && window.store) {
const state = window.store.getState(); const state = window.store.getState();
if (!recsys.entries[claimId]) { if (!recsys.entries[claimId]) {
recsys.createRecsysEntry(claimId); recsys.createRecsysEntry(claimId);
@ -90,7 +90,7 @@ const recsys = {
* @param: parentUuid: string (optional) * @param: parentUuid: string (optional)
*/ */
createRecsysEntry: function (claimId, parentUuid) { createRecsysEntry: function (claimId, parentUuid) {
if (window.store && claimId) { if (window && window.store && claimId) {
const state = window.store.getState(); const state = window.store.getState();
const { id: userId } = selectUser(state); const { id: userId } = selectUser(state);
if (parentUuid) { if (parentUuid) {
@ -170,7 +170,7 @@ const recsys = {
* if so, send the Entry. * if so, send the Entry.
*/ */
onPlayerDispose: function (claimId, isEmbedded) { onPlayerDispose: function (claimId, isEmbedded) {
if (window.store) { if (window && window.store) {
const state = window.store.getState(); const state = window.store.getState();
const playingUri = selectPlayingUri(state); const playingUri = selectPlayingUri(state);
const primaryUri = selectPrimaryUri(state); const primaryUri = selectPrimaryUri(state);
@ -193,7 +193,7 @@ const recsys = {
// * more events until player is disposed. Don't send unless floatingPlayer playingUri // * more events until player is disposed. Don't send unless floatingPlayer playingUri
// */ // */
// onLeaveFilePage: function (primaryUri) { // onLeaveFilePage: function (primaryUri) {
// if (window.store) { // if (window && window.store) {
// const state = window.store.getState(); // const state = window.store.getState();
// const claim = makeSelectClaimForUri(primaryUri)(state); // const claim = makeSelectClaimForUri(primaryUri)(state);
// const claimId = claim ? claim.claim_id : null; // const claimId = claim ? claim.claim_id : null;
@ -219,7 +219,7 @@ const recsys = {
* Send all claimIds that aren't currently playing. * Send all claimIds that aren't currently playing.
*/ */
onNavigate: function () { onNavigate: function () {
if (window.store) { if (window && window.store) {
const state = window.store.getState(); const state = window.store.getState();
const playingUri = selectPlayingUri(state); const playingUri = selectPlayingUri(state);
const actualPlayingUri = playingUri && playingUri.uri; const actualPlayingUri = playingUri && playingUri.uri;