Skip to content

Commit f033eca

Browse files
committed
fix: missing group variables
1 parent 23f7e52 commit f033eca

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

lib/entity/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export class Attributes {
9393
}
9494

9595
async evaluate() {
96+
await this.evaluateAttribute(':group')
9697
await this.evaluateClass()
9798
await this.evaluateText()
9899
await this.evaluateValue()

lib/entity/data.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ export class Data {
88
this.entity = entity
99
this._variables = new Map() // key: variable, value: attributes
1010
this._attributes = new Map() // key: attribute, value: variables
11+
this.groupVariables = []
1112
}
1213

1314
get variables() {
1415
return Array.from(this._variables.keys())
1516
}
1617

17-
get groupVariables() {
18-
return this.variables.filter((variable) => State.isGroupState(variable))
19-
}
20-
2118
getAttributeVariables(attr) {
2219
return this._attributes.get(attr) ?? []
2320
}
@@ -37,7 +34,7 @@ export class Data {
3734
const expr = this.entity.element.getAttribute(attr)
3835
if (!expr) return
3936

40-
const variables = this.getAttributeVariables()
37+
const variables = this.getAttributeVariables(attr)
4138

4239
if (variables.length) {
4340
variables.forEach((variable) => {
@@ -60,14 +57,16 @@ export class Data {
6057
}
6158

6259
const lexer = new Lexer(expr)
60+
const isGroupAttr = attr === ':group'
6361

6462
lexer.identifiers.forEach((variable) => {
6563
if (IGNORED_IDS.includes(variable)) return
6664

6765
const object = variable.split('.')[0]
6866
if (object in this.entity.state) return
6967

70-
this.add(variable, attr)
68+
if (isGroupAttr) this.groupVariables.push(variable)
69+
else this.add(variable, attr)
7170
})
7271
}
7372

lib/state.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ export class State {
205205
}
206206

207207
evaluate() {
208-
Array.from(this.entities.values()).forEach((entity) => {
209-
entity.attributes.evaluateAttribute(':group')
208+
Array.from(this.entities.values()).forEach(async (entity) => {
210209
entity.attributes.evaluate()
211210
})
212211

0 commit comments

Comments
 (0)