Skip to content

Commit 0a449a3

Browse files
committed
[IMP] awesome_dashboard: Fix reload
1 parent ca9b0de commit 0a449a3

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

awesome_dashboard/static/src/dashboard/dashboard.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, onWillStart, useState } from "@odoo/owl";
1+
import { Component, onWillStart, reactive } from "@odoo/owl";
22
import { registry } from "@web/core/registry";
33
import { useService } from "@web/core/utils/hooks";
44
import { Layout } from "@web/search/layout";
@@ -12,8 +12,7 @@ class AwesomeDashboard extends Component {
1212

1313
setup() {
1414
this.action = useService("action");
15-
this.statisticService = useService("statistics");
16-
this.statistics = useState(this.statisticService);
15+
this.state = reactive({ statistics: useService("statistics") });
1716
this.items = dashboard_items;
1817
}
1918

awesome_dashboard/static/src/dashboard/dashboard.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="d-flex align-items-start flex-wrap">
1818
<t t-foreach="items" t-as="item" t-key="item.id">
1919
<DashboardItem size="item.size || 1">
20-
<t t-set="itemProp" t-value="item.props ? item.props(statistics) : {'data': statistics}"/>
20+
<t t-set="itemProp" t-value="item.props ? item.props(state.statistics) : {'data': state.statistics}"/>
2121
<t t-component="item.Component" t-props="itemProp" />
2222
</DashboardItem>
2323
</t>

awesome_dashboard/static/src/dashboard/statistics_service.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { reactive } from "@odoo/owl";
21
import { rpc } from "@web/core/network/rpc";
32
import { registry } from "@web/core/registry";
43
import { memoize } from "@web/core/utils/functions";
@@ -9,7 +8,7 @@ export async function loadStatistic() {
98

109
export const statisticsService = {
1110
async start() {
12-
const data = reactive(await loadStatistic());
11+
let data = await loadStatistic();
1312

1413
setInterval(async () => {
1514
data = await loadStatistic();

0 commit comments

Comments
 (0)