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

Fixed an issue with notifications and recursive promises #13

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

chrisdp
Copy link
Contributor

@chrisdp chrisdp commented Dec 13, 2023

The code supplied here results in only the "outer" being called:

recursivePromise = promises.resolve(true)

promises.onFinally(recursivePromise, sub(recursivePromise as dynamic)
	print "outer"
	promises.onThen(recursivePromise, sub(recursivePromise as dynamic)
		print "inner"
	end sub)
end sub, recursivePromise)

This PR addresses a case where registering listeners from within a callback on the same promise fails to correctly notify all the listeners.

@chrisdp chrisdp added the bug Something isn't working label Dec 13, 2023
src/source/promises.bs Outdated Show resolved Hide resolved
@chrisdp chrisdp merged commit 39745ac into master Dec 14, 2023
2 checks passed
@chrisdp chrisdp deleted the bugfix/recursive-promises-fail-to-notify branch December 14, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants