Skip to content

Cancelling CancellablePromise doesn't cancel promise #278

@Mehuge

Description

@Mehuge

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:

[Log] startBind 0 (hud.js, line 81740)
[Log] listenForKeyBindingAsync undefined (hud.js, line 81749)
[Log] GAME TASK: NEW ACTIVE TASK 3722305007 cancel=undefined (hud.js, line 21171)
[Log] GAME TASK: ACTIVE TASK {"id":3722305007} (hud.js, line 21181)
[Log] this.cancel (hud.js, line 81777)
[Log] cancel keybind listener (hud.js, line 81780)
[Log] GAME TASK: CANCEL TASK 3722305007 (hud.js, line 21188)
[Log] GAME TASK: taskComplete | {"id":3722305007,"statusCode":2,"value":{"__Type":"Binding","name":"/","value":191}} (hud.js, line 21207)
[Log] GAME TASK: RESOLVE TASK {"id":3722305007,"cancelled":true} (hud.js, line 21213)
[Error] CancellablePromise: resolved after being cancelled
	(anonymous function) (hud.js:21226)
[Log] this.cancel (hud.js, line 81777)
[Error] Key bind failed {"cancelled":true,"errorMessage":"promise has been cancelled"}
	(anonymous function) (hud.js:81756)
	promiseReactionJob

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions