[IMP] mail: use useComponent instead of Component.current

Part of task-2694208

closes odoo/odoo#83898

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2022-02-03 14:22:58 +00:00
parent 52256398c9
commit 092864b5dd
3 changed files with 6 additions and 7 deletions
@@ -1,6 +1,6 @@
/** @odoo-module **/
const { Component } = owl;
const { useComponent } = owl;
/**
* This hook provides support for dynamic-refs.
@@ -9,7 +9,7 @@ const { Component } = owl;
* and values are refs.
*/
export function useRefs() {
const component = Component.current;
const component = useComponent();
return function () {
return component.__owl__.refs || {};
};
@@ -2,7 +2,7 @@
import { Listener } from '@mail/model/model_listener';
const { Component, onMounted, onPatched } = owl;
const { onMounted, onPatched, useComponent } = owl;
/**
* This hooks provides support for accessing the values returned by the given
@@ -14,7 +14,7 @@ const { Component, onMounted, onPatched } = owl;
* @returns {function} function to call to retrieve the last rendered values.
*/
export function useRenderedValues(selector) {
const component = Component.current;
const component = useComponent();
let renderedValues;
let patchedValues;
const { modelManager } = component.env.services.messaging;
@@ -1,7 +1,6 @@
/** @odoo-module **/
'use strict';
const { Component, onPatched } = owl;
const { onPatched, useComponent } = owl;
/**
* Shallow compares props `a` and `b`.
@@ -30,7 +29,7 @@ function isEqual(a, b) {
* comparing props.
*/
export function useShouldUpdateBasedOnProps() {
const component = Component.current;
const component = useComponent();
let forceRender = false;
component.shouldUpdate = nextProps => {
if (forceRender) {