Page MenuHomePhabricator

[native] Display edited message content in the pending threads
ClosedPublic

Authored by kuba on Apr 4 2023, 11:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 5, 1:26 AM
Unknown Object (File)
Sun, May 5, 1:26 AM
Unknown Object (File)
Sun, May 5, 1:26 AM
Unknown Object (File)
Sun, May 5, 1:26 AM
Unknown Object (File)
Sun, May 5, 12:52 AM
Unknown Object (File)
Sat, May 4, 7:50 AM
Unknown Object (File)
Thu, May 2, 8:47 AM
Unknown Object (File)
Mar 27 2024, 10:24 PM
Subscribers

Details

Summary

Previously: [fix] Fix 'Maximum update depth exceeded' on native when opening tooltip
Can't open the tooltip menu, because of maximum update depth exceeded warning.
Issue: https://linear.app/comm/issue/ENG-3584/cant-open-tooltips-on-native

Changed the way in which the updated content in the pending thread was displayed. Now, a new edit message is added to the pending thread, instead of modifying the existing one.

Test Plan

Run the app on iOS, open the tooltip menu, it should work. Checked on web if everything still works. Checked if height measurement doesn't display warnings in the console.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

It would be nice if you could explain a bit more precisely what the problem was. From your fix it seems the problem was with a pending thread only? But from the description of the problem it seems that the problem was with opening any tooltip. Does it work in other cases?

Why don't you display the edited label when the thread is pending?

web/chat/composed-message.react.js
128 ↗(On Diff #24620)

Hardcoding this label in two places is error-prone. Can you create it in one place and export it?

@kuba has not made it clear, but it appears that this diff solves a push-blocking issue: ENG-3584

If so, and if this diff cannot be landed within a matter of hours, then the offending commit should be immediately reverted.

@kuba, can you rebase this on master so that it includes the un-revert of your reverted diff?

Address @inka comments

kuba marked an inline comment as done.

New function to display labels

In D7301#217546, @inka wrote:

It would be nice if you could explain a bit more precisely what the problem was. From your fix it seems the problem was with a pending thread only? But from the description of the problem it seems that the problem was with opening any tooltip. Does it work in other cases?

The problem was with changing the content of the messageInfo of the message. If the message content was changed it forced re-rendering and went into an infinite loop. The tooltip just triggered this bug, which froze the whole app. Right now, I changed how edited messages content in pending threads is updated, and prevented from going into an infinite loop.

I tested it (on iOS and the web) and right now it works, I couldn't trigger this same issue again.

Why don't you display the edited label when the thread is pending?

It was discussed here: https://phab.comm.dev/D7141?id=23989#inline-47335

In case, that we created a sidebar from an edited message we can't determine if the source message was edited for the sidebar thread. Therefore, I don't display the Edited label here. To have consistent behavior, I don't display the Edited label in the pending thread as well. Otherwise, it would disappear anyway after sending the message with creates the sidebar.

To make it clear, if we edit the source message after creating the sidebar, the Edit label is displayed as expected (both on the main thread and sidebar).

web/chat/composed-message.react.js
128 ↗(On Diff #24620)

I put it into a separate method. I hope that was what you meant.

Thank you for explaining

This revision is now accepted and ready to land.Apr 12 2023, 3:02 AM
kuba retitled this revision from [fix] Fix 'Maximum update depth exceeded' on native when opening tooltip to [native] Display edited message content in the pending threads.Apr 12 2023, 6:02 AM
kuba edited the summary of this revision. (Show Details)