mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] store: connected component reuse base component name
Connected component should have a unique name. To achieve this the connected component currently have an id based generated name (like `ConnectedComponent1`). To make it clearer and ease debugging this commit reuse the extended component's name to include it in the generated name in the form of `Connected<ComponentName>`.
This commit is contained in:
committed by
Géry Debongnie
parent
35c1de26b8
commit
5524c2e323
+1
-3
@@ -170,8 +170,6 @@ interface StoreOptions {
|
||||
deep?: boolean;
|
||||
}
|
||||
|
||||
let nextID = 1;
|
||||
|
||||
export function connect<E extends EnvWithStore, P, S>(
|
||||
Comp: Constructor<Component<E, P, S>>,
|
||||
mapStoreToProps,
|
||||
@@ -292,7 +290,7 @@ export function connect<E extends EnvWithStore, P, S>(
|
||||
// this is necessary for Owl to be able to properly deduce templates.
|
||||
// Otherwise, all connected components would have the same name, and then
|
||||
// each component after the first will necessarily have the same template.
|
||||
let name = `ConnectedComponent${nextID++}`;
|
||||
let name = `Connected${Comp.name}`;
|
||||
Object.defineProperty(Result, "name", { value: name });
|
||||
return Result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user