inaturalist / inaturalist

The Rails app behind iNaturalist.org
http://www.inaturalist.org
MIT License
666 stars 192 forks source link

Updating profile pic reverts to previous profile pic after save #4280

Closed kueda closed 3 days ago

kueda commented 1 week ago

Describe the bug When you choose a new profile pic, the image on users/edit updates immediately updates, but when you click SAVE SETTINGS and the update completes, the image reverts to the previous profile pic. If you reload the page, the most recently-chosen pic appears.

To Reproduce Steps to reproduce the behavior:

  1. Sign in to an account with a profile pic and go to https://www.inaturalist.org/users/edit
  2. Click on "Upload a new photo" and choose a new photo
  3. When you chosen the photo, it immediately appears in the profile pic area (though it looks squished if the photo was not a square)
  4. Click SAVE SETTINGS (note, no loading indicator while things are saving)
  5. When the save is complete, the profile pic has reverted to the previous profile pic
  6. Reload the page; now the profile pic is the most recent one you chose

Expected behavior Non-square photos should not appear squished immediately after choosing them, and saving the settings should not make it look like the profile pic change got reverted.

Context

Additional context The update is clearly working, so I'm guessing the API response is not getting the latest photo after saving, or the UI isn't updating correctly.

pleary commented 3 days ago

The issue where the profile appeared not to change should be fixed by merging in https://github.com/inaturalist/inaturalist/pull/3957. The problem was if the extension was not changing, the URL would not change, and CloudFront would have cached the previous asset. We would queue a cache invalidation, but that can take some time. With that PR merged in, we will be generating new URLs for updated user icons so there shouldn't be any stagnant caches.

The issue with the display of uploaded icons should be fixed in 1e8cc96048a85447f55b4227d018713548c66c16