Skip to content

Commit 9db8b6c

Browse files
committed
2.7.4 fix: bugs due to nested getter evaluation
Closes #462 #463
1 parent 3458d69 commit 9db8b6c

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

packages/browser-extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Alpine.js devtools - Early Access",
33
"description": "DevTools extension for debugging Alpine.js applications.",
4-
"version": "2.7.3",
4+
"version": "2.7.4",
55
"manifest_version": 3,
66
"icons": {
77
"16": "icons/16.png",

packages/browser-extension/nested-getters.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ <h2 x-text="title"></h2>
2626
<p><button @click="onClick" data-testid="click-target">Click me</button></p>
2727
</div>
2828

29+
<section x-data="page">
30+
<h1 x-text="titleDisplay"></h1>
31+
<div x-data="myData">
32+
<p x-text="textDisplay"></p>
33+
</div>
34+
</section>
35+
2936
<script>
3037
document.addEventListener('alpine:initializing', () => {
3138
Alpine.data('parent', () => ({
@@ -47,6 +54,22 @@ <h2 x-text="title"></h2>
4754
return this.messages.join(', ');
4855
},
4956
}));
57+
58+
Alpine.data('page', () => ({
59+
title: 'test',
60+
61+
get titleDisplay() {
62+
return this.title.toUpperCase();
63+
},
64+
}));
65+
66+
Alpine.data('myData', () => ({
67+
text: 'hello world',
68+
69+
get textDisplay() {
70+
return this.text + '!';
71+
},
72+
}));
5073
});
5174
</script>
5275
</body>

packages/browser-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "browser-extension",
33
"private": true,
4-
"version": "2.7.3",
4+
"version": "2.7.4",
55
"description": "Alpine.js devtools with Chrome manifest v3 compatibility",
66
"type": "module",
77
"scripts": {

packages/browser-extension/src/scripts/backend.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export function init(forceStart = false) {
120120
*/
121121
getAlpineDataInstance(node, config = { getRawInstance: true }) {
122122
if (this.isV3) {
123-
if (config.getRawInstance || node._x_dataStack.length === 1) {
123+
if (config.getRawInstance || node._x_dataStack?.length === 1) {
124124
return node._x_dataStack?.[0];
125125
}
126126
// For accessing the data contents, we need to inherit scoped data.
@@ -338,6 +338,9 @@ export function init(forceStart = false) {
338338
// But ensure Alpine recomputes this effect if any of
339339
// the parents change as they could be used in the getter
340340
Object.keys(stack).forEach((k) => {
341+
if (recursionDepth >= 10) {
342+
return;
343+
}
341344
visit(stack, k);
342345
});
343346
}

0 commit comments

Comments
 (0)