-
Notifications
You must be signed in to change notification settings - Fork 25
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
Cancelling CancellablePromise
doesn't cancel promise
#278
Comments
Annotated trace
User clicks key to bind, client calls
Library gets handle id (task id) from API and wraps a promise around the resolve/reject functions.
User clicks X to cancel keybind request. This calls cancel() on the promise.
Library does engine.trigger('CancelTask', handle.id) to cancel the task.
User presses a key, so the key bind listener (which should have stopped listening) erroneously triggers a taskComplete event in the client.
The taskComplete event handler (now recognising its a cancelled promise - new code I added) rejects it.
The |
Not sure how the Game API is supposed to work, but I would guess that sending the CancelTask event should have told the keybind listener code to stop, thus preventing the subsequent capture of a key and resolving of the promise. |
Found while investigating an issue with keybinds. If you click a key to bind, and say no or close the dialog, it calls
this.listenerPromise.cancel()
however the next key press still fulfills the promise, causing a prompt to bind the key.I added some debugs to
KeybindRow.tsx
to demonstrate this:Not sure how
listenForKeyBindingAsync
is intended to work, but would cancelling the promise cancel the capture of the key press anyway? Don't we need to also tell the game client to stop listening?The text was updated successfully, but these errors were encountered: