[FIX] web, website: correct items order on website systray

Before that commit, after the OWL2 rebase, the website systray items
were shuffled following those steps:
- Install website_blog
- Go to the posts list
- Click on a post
-> Until now, the systray items are correctly sorted
- Go back to the posts list, clicking on the blog navbar menu
-> Items are shuffled

For now, a temporary fix is to add an empty div with the index of the
item as the data-attribute to somehow force the rerender of the systray
items. That bug should be investigated further.

See merge commit for more information.

task-2687506
This commit is contained in:
Younn Olivier
2022-06-24 10:28:05 +02:00
committed by qsm-odoo
parent 8925df7e75
commit 3326281e1a
2 changed files with 3 additions and 1 deletions
@@ -30,6 +30,8 @@
<!-- Systray -->
<div class="o_menu_systray d-flex flex-shrink-0 ml-auto" role="menu">
<t t-foreach="systrayItems" t-as="item" t-key="item.key">
<!-- This ensures the correct order of the systray items -->
<div t-att-data-index="item.index"/>
<ErrorHandler onError="error => this.handleItemError(error, item)">
<t t-component="item.Component" t-props="item.props"/>
</ErrorHandler>
@@ -59,7 +59,7 @@ patch(NavBar.prototype, 'website_navbar', {
if (this.websiteService.currentWebsite) {
return websiteSystrayRegistry
.getEntries()
.map(([key, value]) => ({ key, ...value }))
.map(([key, value], index) => ({ key, ...value, index }))
.filter((item) => ('isDisplayed' in item ? item.isDisplayed(this.env) : true))
.reverse();
}