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

onbeforeremove should tolerate thenables that synchronously resolve #2592

Open
dead-claudia opened this issue May 2, 2020 · 0 comments
Open
Assignees
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage

Comments

@dead-claudia
Copy link
Member

Mithril version: v2.0.4 (not new, though)

Browser and OS: All

Project:

Code

const Comp = {
	view: () => m("div"),
	onbeforeremove: () => {
		then(resolve, reject) {
			resolve(delay(100))
		},
	},
}

function delay(ms) {
	return new Promise(resolve => { setTimeout(resolve, ms) })
}

Steps to Reproduce

Expected Behavior

It to operate asynchronously

Current Behavior

It doesn't wait.

Context

We're not honoring the Promises/A+ spec here. And fixing this is as simple as changing these two lines to wrap their this value with Promise.resolve(...).

@dead-claudia dead-claudia added Type: Bug For bugs and any other unexpected breakage Area: Core For anything dealing with Mithril core itself labels May 2, 2020
@dead-claudia dead-claudia self-assigned this May 2, 2020
@dead-claudia dead-claudia mentioned this issue Oct 13, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage
Projects
Status: Low priority
Development

No branches or pull requests

1 participant