( component: ComponentType
,
type: string,
data: unknown,
) {
- let container = globalStore.get(component);
+ const dataComponent = component as ComponentWithData;
+
+ let container = dataComponent[componentDataKey] ?? globalStore.get(component);
if (!container) {
container = { map: new Map() };
+ Object.defineProperty(dataComponent, componentDataKey, {
+ enumerable: false,
+ configurable: true,
+ writable: false,
+ value: container,
+ });
globalStore.set(component, container);
}
@@ -65,7 +83,7 @@ export function getComponentData