-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): handle symbol properties for dynamic values
- Loading branch information
Showing
3 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...-component/src/__tests__/fixtures/wire-decorator/transforms-computed-properties/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { wire, LightningElement } from "lwc"; | ||
import { getFoo, getBar } from "data-service"; | ||
const key1 = Symbol.for("key"); | ||
export default class Test extends LightningElement { | ||
@wire(getBar, { [key1]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredBar; | ||
|
||
// eslint-disable-next-line no-useless-computed-key | ||
@wire(getFoo, { ["key1"]: "$prop1", key2: ["fixed", "array"] }) | ||
wiredFoo; | ||
} |
40 changes: 40 additions & 0 deletions
40
...omponent/src/__tests__/fixtures/wire-decorator/transforms-computed-properties/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { registerDecorators as _registerDecorators, registerComponent as _registerComponent, LightningElement } from "lwc"; | ||
import _tmpl from "./test.html"; | ||
import { getFoo, getBar } from "data-service"; | ||
const key1 = Symbol.for("key"); | ||
class Test extends LightningElement { | ||
wiredBar; | ||
|
||
// eslint-disable-next-line no-useless-computed-key | ||
wiredFoo; | ||
/*LWC compiler vX.X.X*/ | ||
} | ||
_registerDecorators(Test, { | ||
wire: { | ||
wiredBar: { | ||
adapter: getBar, | ||
dynamic: [key1], | ||
config: function ($cmp) { | ||
return { | ||
key2: ["fixed", "array"], | ||
[key1]: $cmp.prop1 | ||
}; | ||
} | ||
}, | ||
wiredFoo: { | ||
adapter: getFoo, | ||
dynamic: ["key1"], | ||
config: function ($cmp) { | ||
return { | ||
key2: ["fixed", "array"], | ||
["key1"]: $cmp.prop1 | ||
}; | ||
} | ||
} | ||
} | ||
}); | ||
export default _registerComponent(Test, { | ||
tmpl: _tmpl, | ||
sel: "lwc-test", | ||
apiVersion: 9999999 | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters