-
Notifications
You must be signed in to change notification settings - Fork 350
Description
When you tap an image preview in a message, the Hero animation needs a "tag" that uniquely identifies the image on the route (i.e., among all other images in the message list).
Currently, _LightboxHeroTag fails to uniquely identify an image when there are multiple image previews with the same URL in a message. The effect is that there is no Hero animation, and an error is logged to the console:
======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
There are multiple heroes that share the same tag within a subtree.
Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag.
In this case, multiple heroes had the following tag: […]
The bug is a bit tricky to reproduce: the open-lightbox-on-tap handler is on the image preview widget itself, not on the image link text, and (empirically) servers try to deduplicate image previews in a message with the same URL. Try something like this to thwart that deduplication:
[image](/user_uploads/2/fd/AogAK3meEt4GkXJaDvDXNwyy/image.png)
[image](https://chat.zulip.org/user_uploads/2/fd/AogAK3meEt4GkXJaDvDXNwyy/image.png)
This TODO on _LightboxHeroTag gives a recipe for a potential fix:
// TODO: Add index of the image preview in the message, to not break if
// there are multiple image previews with the same URL in the same
// message. Maybe keep `src`, so that on exit the lightbox image doesn't
// fly to an image preview with a different URL, following a message edit
// while the lightbox was open.Metadata
Metadata
Assignees
Labels
Type
Projects
Status