FIX 3 bugs related to getters and classes#471
Open
serhumanos wants to merge 2 commits into
Open
Conversation
When a getter in a child Alpine.js component references its own properties using 'this', the devtools extension was incorrectly using only the parent's context, causing 'this' to point to the parent instead of the component itself. The fix collects the child's own non-getter properties first, then creates a combined context (parent + child, with child taking precedence) before evaluating getters. This matches Alpine.js's actual runtime behavior. Before: - Getter in child accessing this.childProp → undefined (wrong) - Getter in child accessing this.parentProp → works (correct) After: - Getter in child accessing this.childProp → works (correct) - Getter in child accessing this.parentProp → works (correct)
- Modified getAlpineDataInstance() to traverse the prototype chain and capture getters, methods, and properties inherited from classes. - Updated watchComponents() to use getAllEnumerablePropertyNames(), which also traverses the prototype chain, allowing detection of changes in inherited properties. - This enables using Alpine.data() with instances of classes that extend base components (e.g., WizardPasoComponent) while maintaining full visibility in the devtools.
Author
|
Added the fix #472 |
This was referenced Jun 13, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FIXES ISSUES: