MemeLabs / Rustla2

Livestream viewing with chat
https://strims.gg
MIT License
44 stars 24 forks source link

Streams not loading when a user is logged out #334

Closed Dman757 closed 3 years ago

Dman757 commented 3 years ago

Issue: When I am logged out and click on a stream from the home page the iframe doesn't load unless the stream page is refreshed.

For some context I asked about this bug in the #feedback channel on discord and started doing some digging: https://discordapp.com/channels/464209732291264513/464211660400361492/779870252858081351

Issue Report

This is the dom node when navigating to the page: chrome_Rtgotj8rsq

After a refresh (or being logged in) it is populated chrome_3S68NtXruR

Some Investigation

I investigated the issue a little bit using the chrome and react devtools in the browser.

On the home page I get this type error as well as a few 401's attempting to fetch profile info: chrome_g4uIZNy4T9

Prettifying the code from the type error it appears to be something with profile login attempt failure: chrome_i0WVe8UcLg

Inspecting the react tree with react-devtools it appears that a loading variable isFetchingProfile is never set to false chrome_VbqyyFs0ih

I did a quick github search of this repo for isFetchingProfile it would appear that this recompose branch() function would cause renderNothing does what the name implies. https://github.com/MemeLabs/Rustla2/blob/7e636f78ad8ce0a4e10ad54a3fe7a4654ebebc71/src/components/Stream.jsx#L108

TL;DR It looks like there's an error thrown for non-authenticated users that causes isFetchingProfile to always be true thus causing Stream.jsx to never return anything.

Also I guess I should note I haven't run the build locally. Just hope this helps someone resolve the issue.