hyperspacedev / hyperspace

The new beautiful, fluffy client for Mastodon in React + TypeScript
https://hyperspace.marquiskurt.net
Other
183 stars 27 forks source link

[Bug] Avatar in App header, on change, requires refresh to show new avatar #194

Closed travisk-codes closed 4 years ago

travisk-codes commented 4 years ago

Describe the bug If you change your avatar, it appears to update (without refresh) everywhere except for the header, which updates upon refresh.

To Reproduce Steps to reproduce the behavior:

  1. Edit profile
  2. Change avatar
  3. Witness updates on Edit Profile page header, Profile Page header and posts
  4. Witness lack-of-update in App header

Expected behavior The App Header to update along with everything else

Screenshots image

App Information (please complete the following information):

Additional context Minor, low-pri

alicerunsonfedora commented 4 years ago

Probably a local storage issue, if I were to guess. It doesn’t necessarily pick up changes to it immediately and often requires a refresh

travisk-codes commented 4 years ago

Looks like all other avatar locations are loaded on didMount (update makes sense when navigating to a new page) or are updated via setState, which makes sense for the immediate update on You.tsx. Does it make sense to lift state up into AppLayout? Doesn't seem like the correct concern. are localStorage updates made everywhere immediately?

alicerunsonfedora commented 4 years ago

I don't think localStorage loads immediately, hence why some places require that we refresh the browser. It's also a bit tricky tying AppLayout with the pages since they're in separate locations, in addition to it being "higher" up in the tree.

travisk-codes commented 4 years ago

Do you think account info would be a good use case for React context? Or would context be a good solution here?

alicerunsonfedora commented 4 years ago

Perhaps. I'm a little unfamiliar with it, but it's worth a try.