Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Cornerstone 2.0: Performance improvements #1229
Cornerstone 2.0: Performance improvements #1229
Changes from all commits
970d0e5
886ce4b
3d4d715
31bdddb
2f53571
3a62b5c
9a8d499
4ee4620
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can speak for scala world when i say "Awaits" are not great. Not sure if its the same in JS tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async/await pattern is an alternate way of working with promises.
await
is essentially the same asPromise.then
without all the code nesting. https://javascript.info/async-awaitThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
await
gettranspiled
bystencil-cli
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
await
is non-blocking in JS, so not like theAwait
object in Scala. Fun fact, there's an async/await macro library for Scala that does the same thing: https://github.com/scala/scala-asyncIt basically rewrites the code to use
.map
and.flatMap
in the compiler.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@icatalina Yes, we are running everything through babel in stencil CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const pageClass = await xx <-- how can this be async what if somone uses the pageClass val before the await is resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RegisteredCustomerMessagesUITest::testRequiredFieldWhileCreatingMessage
same this.context undefined message
along with this updated (removed span)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tpietsch for the
const pageClass = await xx
example, it's simply sugar for using a promise.then, so it will not set the pageClass val until after the await is resolved. but it's non-blocking in that the thread is released when invoking await to handle other things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it just kinda not my fave cause now you have a variable in scope that you can use where the value might change right? first its undef then its def and between that time it can be read from incorrectly
In a normal Promise(resolve -> resolve.data) <-- you are more explicit about when the data is being used here it seems like it could cause intermittent weirdness. And also the variable is declared as a const which i would expect as non-changing value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe Babel actually dumps a bunch of polyfill code in order to support
async/await
(it needs to support ES6 generator). Wouldn't this increase the file size, as you need bothPromise
andGenerator
instead of justPromise
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can you be sure this order doesnt matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to call
bind
becauseonReady
is already bounded topage
.