Skip to content
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

$nextTick after component update or after render? #287

Closed
ahmedkandel opened this issue Mar 17, 2020 · 3 comments · Fixed by #289
Closed

$nextTick after component update or after render? #287

ahmedkandel opened this issue Mar 17, 2020 · 3 comments · Fixed by #289

Comments

@ahmedkandel
Copy link
Contributor

$nextTick is expected to execute a given expression AFTER Alpine has made its reactive DOM updates the same as Vue-nextTick. But looking at the source code there is some confusion "Maybe I am wrong".

Here in component.js line 107 the expression should be excuted. But it will not, as self.nextTickStack will be empty already when reaching this point because it has been iterated in initializeElements or updateElements.

@HugoDF @SimoTod what do you think? should lines [107-109] be removed if they are useless?

@SimoTod
Copy link
Collaborator

SimoTod commented Mar 17, 2020

I see, in my opinion line 107-109 are correct but lines 179-182 are wrong.
I need to try a couple of cases, though.

@SimoTod
Copy link
Collaborator

SimoTod commented Mar 17, 2020

okay, I think you are right. lines 107-109 seem pointless and it makes more sense to keep the one in updateEvents.

@ahmedkandel
Copy link
Contributor Author

Yes, I will do more checks then make a PR. Thanks @SimoTod

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 a pull request may close this issue.

2 participants