[FIX] mail: fix scroll flicker on thread start

The `onWillStart` hook that was used in the thread component but was
replaced  by the `onMounted` hook. Indeed, fetching the messages in
the `onWillStart` hook was leading to an infinite loop (props updated
as a side-effect of the `onWillStart` hook).

After messages are loaded, the scroll position of the thread is
restored. Since this is done after the component is mounted, another
render is triggered and results in a flicker when opening the thread.

This commit fixes this issue by waiting for the thread to be mounted
and for the scroll position to be restored before showing the message
list.

closes odoo/odoo#141145

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
tsm-odoo
2023-11-06 12:32:06 +00:00
parent 99d19caec1
commit f10c9114e6
@@ -17,7 +17,7 @@
<span t-ref="load-newer"/>
<t t-if="!env.inChatter" t-call="mail.Thread.jumpPresent"/>
</t>
<t t-foreach="props.order === 'asc' ? props.thread.nonEmptyMessages : [...props.thread.nonEmptyMessages].reverse()" t-as="msg" t-key="msg.id">
<t t-if="state.mountedAndLoaded" t-foreach="props.order === 'asc' ? props.thread.nonEmptyMessages : [...props.thread.nonEmptyMessages].reverse()" t-as="msg" t-key="msg.id">
<t t-if="msg.dateDay !== currentDay and props.showDates">
<DateSection date="msg.dateDay" className="'pt-4'"/>
<t t-set="currentDay" t-value="msg.dateDay"/>