Skip to content

Backport: fix scanPrototypesFor cache when class init is in flight#38

Merged
bemky merged 1 commit into
1.xfrom
fix-scan-prototypes-cache-1.x
May 7, 2026
Merged

Backport: fix scanPrototypesFor cache when class init is in flight#38
bemky merged 1 commit into
1.xfrom
fix-scan-prototypes-cache-1.x

Conversation

@bemky
Copy link
Copy Markdown
Owner

@bemky bemky commented May 7, 2026

Summary

Test plan

  • npm test — full suite passes (36 passing), including the four new scanPrototypesFor cases.

🤖 Generated with Claude Code

The memoization in 7d67a95 caches the merged prototype-chain values per
(constructor, key) pair. When `customElements.define` upgrades a
pre-existing element mid-class-body, the constructor runs before the
subclass's `static <key> = ...` fields have initialized, so the first
scan caches a result missing the subclass's own value. All subsequent
instances then inherit the wrong merged metadata (e.g. empty
assignableAttributes).

Track the constructor's own-property status alongside each cached entry
and recompute when it flips. Plugin-style in-place mutations to the
cached arrays still propagate.

Add a regression test in test/supportTest.js.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bemky bemky merged commit 5bafa8e into 1.x May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant