Skip to content

Conversation

@lluisemper
Copy link

Summary

Fixes #35203

The compiler was incorrectly discarding computed property key notation
when used with method shorthand syntax, transforming [key]() {} into
key() {}.

Changed the hardcoded false parameter to property.key.kind === 'computed'
in CodegenReactiveFunction.ts to preserve computed keys, matching the
pattern already used for regular object properties.

How did you test this change?

TDD, adding tests

  Fixes facebook#35203

  The compiler was incorrectly discarding computed property key notation
  when used with method shorthand syntax, transforming `[key]() {}` into
  `key() {}`.

  Changed the hardcoded `false` parameter to `property.key.kind === 'computed'`
  in CodegenReactiveFunction.ts to preserve computed keys, matching the
  pattern already used for regular object properties.
@meta-cla meta-cla bot added the CLA Signed label Nov 29, 2025
Copy link
Member

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link

@theFoxCost theFoxCost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lluisemper
that's right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler Bug]: React compiler discards computed property keys when used in method shorthand

3 participants