Skip to content

Commit

Permalink
fix: "Show in Chat" in gallery not working
Browse files Browse the repository at this point in the history
The bug was likely introduced in
#4554
(da4b916)
or in one of the adjacent / related commmits.
FYI the bug has only been released with 1.53.0.
  • Loading branch information
WofWca committed Feb 11, 2025
1 parent 3ed5e59 commit b336bc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Changed

### Fixed
- "Show in Chat" in Gallery not working #4629

<a id="1_53_0"></a>

Expand Down
15 changes: 13 additions & 2 deletions packages/frontend/src/components/message/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,20 @@ export default function MessageList({ accountId, chat, refComposer }: Props) {
}
}
maybeJumpToMessageHack()
// TODO perf: to save memory, maybe set to `undefined` when unmounting,
// but be sure not to unset it if the new component render already set it.
window.__internal_check_jump_to_message = maybeJumpToMessageHack
useEffect(() => {
// Unset this wneh unmounting, so that it's the next component instance
// that handles the `__internal_jump_to_message_asap` value.
// This is important e.g. for "Show in Chat" in the gallery.
// The gallery is displayed when the MessageList component
// is not displayed.
//
// TODO we probably need to ensure that the next component instance
// didn't already set it itself.
return () => {
window.__internal_check_jump_to_message = undefined
}
}, [])

const pendingProgrammaticSmoothScrollTo = useRef<null | number>(null)
const pendingProgrammaticSmoothScrollTimeout = useRef<number>(-1)
Expand Down

0 comments on commit b336bc9

Please sign in to comment.