Skip to content

Commit aae0d41

Browse files
committed
fixes
1 parent 3faee2f commit aae0d41

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/components/plugins/Plugins.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ class InferredPlugins extends ComponentList<InferredProps, Component> {
5353
const { config } = this.props;
5454

5555
return (
56-
<Component key={`${entity.id}_${index}`} id={entity.id} config={config}>
56+
<Component
57+
key={`${entity.id}_${index}`}
58+
id={entity.id}
59+
config={config}
60+
entity={entity}
61+
>
5762
{children}
5863
</Component>
5964
);

src/components/plugins/Proposals.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class InferredProposals extends ComponentList<InferredProps, Component> {
6161
key={`${entity.id}_${index}`}
6262
id={entity.id}
6363
config={this.props.config}
64+
entity={entity}
6465
>
6566
{children}
6667
</Component>

src/runtime/Component.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,16 @@ export abstract class Component<
150150
if (entity !== undefined) {
151151
this._entity = entity;
152152
} else {
153-
const asyncFunction = this.createEntity.bind(this);
154-
this._entity = await executeMaybeAsyncFunction(asyncFunction);
153+
const func = this.createEntity.bind(this);
154+
this._entity = await executeMaybeAsyncFunction(func);
155+
}
156+
157+
if (!this._entity) {
158+
throw Error(`This should never happen, Entity undefined.`);
155159
}
156160

157161
logs.dataQueryStarted();
158-
await this.initialize(this._entity!);
162+
await this.initialize(this._entity);
159163
this._initialized = true;
160164

161165
if (this._subscription) {
@@ -164,11 +168,9 @@ export abstract class Component<
164168

165169
// by default we subscribe to this entity's state changes
166170
if (!props.noSub) {
167-
this._subscription = this._entity!.state({}).subscribe(
168-
this.onQueryData,
169-
this.onQueryError,
170-
this.onQueryComplete
171-
);
171+
this._subscription = this._entity
172+
.state({})
173+
.subscribe(this.onQueryData, this.onQueryError, this.onQueryComplete);
172174
}
173175

174176
this.forceUpdate();

0 commit comments

Comments
 (0)