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

fix: store create operation as object in this.#ops #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nikolockenvitz
Copy link
Contributor

fixes #49 @csuwildcat

As explained there, the create operation was incorrectly stored as a Promise in the operation queue, leading to errors when trying to generate a request for a subsequent operation.
(The create operation was always stored as a Promise, but previously all the operations were awaited with Promise.all() in generateOperation, so that previous always was a pointer to the plain object. With the recent changes, this.#ops was accessed directly and no longer awaited, leading to the described problem. Storing the create operation as a promise is not necessarily incorrect - I just don't see a reason do it it like this while all other operations are stored as plain objects).

Consequently, it would not be necessary anymore for getAllOperations() to be async / use Promise.all(). Same for getOperation().

Is it planned to add tests to this library and/or to migrate to TypeScript? This would have caught the error.

was previously stored as Promise

also fixes one wrong type hint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant