Page MenuHomePhabricator

[web] Fix bug where image appears broken when creating thread with media message
ClosedPublic

Authored by ashoat on Apr 13 2023, 6:51 AM.
Tags
None
Referenced Files
F2145064: D7416.id25115.diff
Sat, Jun 29, 9:20 PM
Unknown Object (File)
Thu, Jun 27, 8:00 PM
Unknown Object (File)
Tue, Jun 25, 8:03 PM
Unknown Object (File)
Thu, Jun 20, 5:50 AM
Unknown Object (File)
Fri, Jun 7, 8:24 AM
Unknown Object (File)
May 30 2024, 12:38 PM
Unknown Object (File)
May 30 2024, 12:38 PM
Unknown Object (File)
May 30 2024, 12:38 PM
Subscribers
None

Details

Summary

Linear issue: ENG-3673

What was happening here in Redux is that the second sendMultimediaMessageActionTypes.started action was overwriting the actualized URI that was set by the second updateMultimediaMessageMediaActionType, which is responsible for replacing the local blob URI with the actualized URI after the preload completes.

Once the preload completes, we unload the blob URI, which is why a [?] was appearing in the UI. We should not use the blob URI after the preload of the actualized URI is completed.

The reason we were using the blob URI was that when sendMultimediaMessage was first called, the preload was not completed yet. But sendMultimediaMessage has to wait for the thread creation to complete, and once the thread creation was complete, the preload had already finished and the blob URI had been unloaded. But sendMultimediaMessage was still using the old RawMessageInfo that had the local blob URI.

This diff fixes the behavior by making sure that sendMultimediaMessage pulls the latest version of the RawMessageInfo from Redux after the thread creation completes.

Test Plan

I created a new thread in my local environment with an image, and made sure to do it quickly by hitting the Enter button on the keyboard repeatedly. It's critical that the thread creation proceed before the image upload completes for the test to work. Before this diff, it led to the issue in the Linear task. After this diff, the issue did not occur.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable