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

async dialog content => async create dialog #280

Merged
merged 2 commits into from
Jul 19, 2021

Conversation

le-jeu
Copy link
Member

@le-jeu le-jeu commented Jul 18, 2021

Wait for dialog content before showing the dialog
This allows jquery/iitc dialog to place the dialog in the center of the screen with respect to the content on opening.

Additionally, don't use Promise.all when all promises are already fulfilled (synchronously)

Copy link
Member

@cloudkucooland cloudkucooland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this works the way intended (or I read as intended)

this._done = false;
}
);
if (instantValues.length < promises.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a style thing, but I'd invert the logic of this

if (IinstantValues.length == promises.length) {
...
return
}

...

and my comment from back in the day says I wanted to try allSettled, did you look into that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a style thing, but I'd invert the logic of this

fine

and my comment from back in the day says I wanted to try allSettled, did you look into that?

no, while it's not fail safe, the point of failure are to be defined first (include how to settle them)
atm, if one row fails, the issue is not only the rendering of the row but login/perm/team

@@ -27,6 +27,8 @@ const MarkerList = OperationChecklistDialog.extend({
this.closeDialog();
};

await this.sortable.done;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done is a getter, which isn't async. does this work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done returns _done that is either a promise or boolean
also, you can always await a constant expression

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd forgotten that _done is ever a promise.

Promise.all is async even if all promises are already fulfilled
@@ -27,6 +27,8 @@ const MarkerList = OperationChecklistDialog.extend({
this.closeDialog();
};

await this.sortable.done;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd forgotten that _done is ever a promise.

@le-jeu le-jeu merged commit cf70f4b into wasabee-project:dev Jul 19, 2021
@le-jeu le-jeu mentioned this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants