Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@wire does not like computed property keys #4988

Open
wjhsf opened this issue Dec 2, 2024 · 3 comments
Open

@wire does not like computed property keys #4988

wjhsf opened this issue Dec 2, 2024 · 3 comments
Labels

Comments

@wjhsf
Copy link
Contributor

wjhsf commented Dec 2, 2024

Description

@wire, in the engine-server implementation, assumes that the identifier being decorated is not a computed value, resulting in the wrong prop being updated.

In the below example, we want to update the computed symbol property for Symbol(please). Instead, we end see that the component's "symbol" property is being updated, replacing the value we though we'd have.

const symbol = Symbol('please');
export default class extends LightningElement {
    symbol = 'nope';

    @wire(adapter, {value: '123'})
    [symbol];

    get symbolIdentifier () {
        return this.symbol ?? 'unset';
    }

    get symbolValue () {
        return this[symbol] ?? 'unset';
    }
}

playground

Steps to Reproduce

https://playground.lwc.dev

const your => (code) => here;

Expected Results

Actual Results

Browsers Affected

Version

  • LWC: x.x.x

Possible Solution

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

@nolanlawson
Copy link
Collaborator

@nolanlawson nolanlawson added the bug label Dec 2, 2024
@cardoso
Copy link
Contributor

cardoso commented Dec 3, 2024

I guess this might be related to #4548? In the sense that the solution (or part of it) might be in babel-plugin-compiler?

@nolanlawson
Copy link
Collaborator

The solution is almost certainly in babel-plugin-component, yes. This is the bit that compiles component .js files and handles decorators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants