| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
|
||
| /** @return {Promise<void>} */ | ||
| delete(): Promise<void> { | ||
| async delete(): Promise<void> { |
There was a problem hiding this comment.
How will this be supported in browsers that don't support async/await. Last time I asked - this wasn't being polyfilled.
If it is - that may be a big polyfill.
Sorry, something went wrong.
There was a problem hiding this comment.
I think TypeScript supports async/await and has downlevel helpers to make the generated code work in ES3/ES5 (https://blog.mariusschulz.com/2016/12/09/typescript-2-1-async-await-for-es3-es5) but we need to see what the resulting code size change is...
Sorry, something went wrong.
|
Hey @merlinnot thanks for the heads up, you can run the tests by creating a test project at https://console.firebase.google.com/ In the mean time, I'll get that URL updated! Thanks! |
Sorry, something went wrong.
|
@jshcrowthe I had a plan to use Travis for testing when I saw you actually run CI for external PRs, glad to see I can do that much easier :) I'll find some time to finish this tomorrow and I'll try to make some size comparison for the built code. |
Sorry, something went wrong.
|
Tests are failing with quota exceeded but otherwise should pass. These changes do indeed increase code size, but this increase is almost constant (helper functions) in gzipped versions and allows us to use async/await all over the place 👍
|
Sorry, something went wrong.
|
@merlinnot Thanks for this cleanup PR! In general, I would be happy to proceed with this if it didn't impact code size as much. Do you think we can find a way to reduce the impact? Adding 9kb to FIrestore is a little hard to swallow, especially since we want to reduce our size in general. |
Sorry, something went wrong.
We have enabled billing for the test projects recently. I have re-kicked your tests to take advantage of this. |
Sorry, something went wrong.
|
I’ll try to take a look on reducing the size impact over the weekend. |
Sorry, something went wrong.
It reduces the size of TypeScript packages (namely `firebase-database`, `firebase-firestore`, `firebase-messaging` and the combined `firebase`) be reusing TypeScript helper methods (e.g. `__awaiter`) which were included in every single file relying on features not available in ES5 (emitted during transpilation process).
|
Ok, here we go:
Some changes were made automatically by Prettier, I guess they've slipped into master somehow (--no-verify? 😉). I decided to leave those as a part of this PR. You can view the relevant changes here and here. Tests are passing locally, there's something wrong with Travis 😟 |
Sorry, something went wrong.
|
I'll resolve all of the issues once we'll agree it's ready to be merged. |
Sorry, something went wrong.
There was a problem hiding this comment.
In general the changes look good, I like where this is headed. When you remerge w/ master, you should pick up some of these prettier changes which should help to trim down what the actual delta is here.
Sorry, something went wrong.
| "compileOnSave": false, | ||
| "compilerOptions": { | ||
| "declaration": true, | ||
| "importHelpers": true, |
There was a problem hiding this comment.
Because you are doing this in the base tsconfig, any helper fxns, across all packages, that match this flag will be required via tslib. As such, we need to add the tslib dependency to all packages using this base config not just the 3 using async/await
Sorry, something went wrong.
There was a problem hiding this comment.
You're right, done in 12c2b54. I've omitted *-types packages as stated in the commit message.
Sorry, something went wrong.
There was a problem hiding this comment.
Perfect, thanks!
Sorry, something went wrong.
…til packages. Since we set `importHelpers` compiler option to `true` in the base config, we need to add `tslib` to all packages. `*-types` packages are omitted since they do not contain any executable code.
|
Merged with master, all changes are meaningful. Travis has some existential problems 😉 Ready for a review. |
Sorry, something went wrong.
There was a problem hiding this comment.
I've reviewed all of the package.json/yarn.lock and top-level config changes and they all look good.
I've given the other files a once over as well and the changes seem fine, though I'll let the other reviewers take a look at those in more depth.
Sorry, something went wrong.
| const fakeSubscription = { | ||
| endpoint: EXAMPLE_TOKEN_SAVE.endpoint, | ||
| unsubscribe: () => Promise.resolve() | ||
| unsubscribe: async () => {} |
There was a problem hiding this comment.
I'm personally not a fan of this pattern - it's difficult to tell what the stubbed behavior should be doing.
Sorry, something went wrong.
There was a problem hiding this comment.
It clearly states "do nothing", doesn't it?
Sorry, something went wrong.
There was a problem hiding this comment.
It's more about the expectation of the API (i.e. return a Promise).
Sorry, something went wrong.
There was a problem hiding this comment.
Would rather the stubs were reverted but not enough to argue about it.
Sorry, something went wrong.
There was a problem hiding this comment.
Approved for Database.
Sorry, something went wrong.
There was a problem hiding this comment.
Approved for Firestore with 2 minor requests (Josh if it's easier, you can merge this and then you or I can fix them).
I also think this leaves us in a somewhat messy state with mixing usage of await with manual Promise chaining within methods. I think we should work towards cleaning this up, but not in this PR, and in general it's not super urgent.
Sorry, something went wrong.
| // Some other error, don't reset stream token. Our stream logic will | ||
| // just retry with exponential backoff. | ||
| return Promise.resolve(); | ||
| } |
There was a problem hiding this comment.
Can you leave the else block (just containing the comment)? It makes the context for the comment more clear.
Sorry, something went wrong.
| }); | ||
| } else { | ||
| // Transient error, just let the retry logic kick in. | ||
| return Promise.resolve(); |
There was a problem hiding this comment.
Again, can you leave the else block?
Sorry, something went wrong.
|
I've verified tests are passing so this is good to go @merlinnot, can you address the two issues from @mikelehen and then we'll get this merged? |
Sorry, something went wrong.
the context more clear. Addresses @mikelehen review firebase#422 (review)
|
Done ✅ |
Sorry, something went wrong.
|
Awesome work here @merlinnot thanks so much for the contribution! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
I cannot make sure all existing tests in the repository pass after these changes since I'm not able to run them. An error message is clear and it says I'd have to create a test project by visiting https://firebase.corp.google.com/ which I'm not allowed to since I'm not a Google employee.
I'd appreciate if someone with access could run all of the tests for me.