Refactor EventTile using the MVVM pattern - #7a (#33640)

* Make EventTileViewModel an owned root VM

* Move timestamp sub-VMs under EventTileViewModel

* Move thread-list action bar VM under EventTileViewModel

* Clean up for improved readability

* Clean up to avoid duplicate EventTile render derivations

* Avoid mutating EventTileViewModel during render

* Move EventTile child VM syncing into adapters

* Replace timestamp VM field setters with batched setProps

* Component wrappers at the end of the file

* Lazy-create EventTile child view models
This commit is contained in:
rbondesson
2026-05-29 07:56:31 +02:00
committed by GitHub
parent 0ed98941bd
commit 3aa3678c2d
6 changed files with 392 additions and 273 deletions
@@ -647,15 +647,7 @@ export const DownloadButton: React.FC<DownloadButtonProps> = ({ url, fileName, m
function MessageTimestampWrapper(props: MessageTimestampViewModelProps): JSX.Element {
const vm = useCreateAutoDisposedViewModel(() => new MessageTimestampViewModel(props));
useEffect(() => {
vm.setTimestamp(props.ts);
vm.setDisplayOptions({
showTwelveHour: props.showTwelveHour,
showFullDate: props.showFullDate,
showSeconds: props.showSeconds,
});
vm.setTooltipInhibited(props.inhibitTooltip);
vm.setHref(props.href);
vm.setHandlers({ onClick: props.onClick });
vm.setProps(props);
}, [vm, props]);
return <MessageTimestampView vm={vm} className="mx_MessageTimestamp" />;
}