-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Inconsistent update with template x-if #2803
Comments
Hi, anyone have any idea on this. Its reproducible. |
I believe I'm experiencing a related issue with In this self-contained example, clicking <html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.10.2/cdn.min.js" defer></script>
</head>
<body>
<h1>Unexpected Behavior</h1>
<div x-data="{state: false}"
x-init="$watch('state', val => {
if (val) {state = false}
})">
<button type="button"
x-show="state"
@click="state = false">
Disable
</button>
<button type="button"
x-show="!state"
@click="state = true">
Enable
</button>
</div>
<h1>Expected Behavior</h1>
<div x-data="{state: false}"
x-init="$watch('state', val => {
setTimeout(() => {if (val) {state = false}}, 100)
})">
<button type="button"
x-show="state"
@click="state = false">
Disable
</button>
<button type="button"
x-show="!state"
@click="state = true">
Enable
</button>
</div>
</body>
</html> |
I've had a similar issue with
will solve the issue, as the queue will become 0: "Hide Screen1 due to This probably requires a proper bugfix, though. |
Adding a real-world example here to illustrate practical implications of this bug. I'm building an audio player with Alpine.js. I'm using a store that represents playback state of an HTML5 audio element. The store listens to a couple of HTMLMediaElement events such as
The bug occurs when a user jumps to another position in the audio that is already buffered. In that case, the audio element fires To anyone interested, I solved the issue by adding a timeout. This cannot be a permanent solution though since it slows down responsivity of the UI. My solution looks something like this:
|
Has this issue also been addressed by the x-show fix? |
@josh-tt Unfortunately not, the x-if issue still exists :( |
Bummer, thanks. I've been on an older version of Alpine and just ran into issues with templates and stores. 3.8.1 working ok for me (some memory issues when fast clicking, but working ok), but anything above that is behaving inconsistently. |
We've had a similar problem with x-if, see #3003 creating a pretty wild memory leak Our solution was to use $nextTick() |
I encounter issues with template swapping and wonder if this is the same issue or am I just missing something with this:
If I manually set arg - ignore, i had to wrap the templates in a div (note to self: template can only a single root node) |
…b is never dequeued from the queue, which would cause other jobs to be accidentally skipped.
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Discussed in #2802
Originally posted by cjloong April 1, 2022
Hi there,
I have a page structured as follows:
section1 (x-if="bar")
section2
The code to control the above is quite complicated. We discovered an intermittent issue where section 2, part 1 sometimes does not appear. Same as part 3.
I have manage to condense the issue into a codepen as follows:
https://codepen.io/cjloong/pen/zYpzQGr
Click on the "Simulation Error" button to reproduce the error.
The text was updated successfully, but these errors were encountered: