[IMP] hooks: useRef on component: set el anyway

Closes #437
This commit is contained in:
Aaron Bohy
2019-11-05 08:39:12 +01:00
committed by Géry Debongnie
parent af4f372506
commit 7e721a96b5
4 changed files with 113 additions and 91 deletions
+6 -1
View File
@@ -104,7 +104,12 @@ export function useRef(name: string): Ref {
return {
get el(): HTMLElement | null {
const val = __owl__.refs && __owl__.refs[name];
return val instanceof HTMLElement ? val : null;
if (val instanceof HTMLElement) {
return val;
} else if (val instanceof Component) {
return val.el;
}
return null;
},
get comp(): Component<any, any> | null {
const val = __owl__.refs && __owl__.refs[name];