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 onClientEntry #1735

Merged
merged 29 commits into from
Aug 18, 2017
Merged

Async onClientEntry #1735

merged 29 commits into from
Aug 18, 2017

Conversation

atrauzzi
Copy link
Contributor

@atrauzzi atrauzzi commented Aug 6, 2017

Tested locally and I'm getting async support in my bootstrap flows during development now.

Let me know what steps I need to take to ensure I'm abiding by gatsby's standards. I think I also will have to update the static app bootstrap as well?

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 6, 2017

Deploy preview ready!

Built with commit 42e3bb3

https://deploy-preview-1735--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 6, 2017

Deploy preview ready!

Built with commit 42e3bb3

https://deploy-preview-1735--gatsbygram.netlify.com

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Looking good!

Gatsby runs its APIs in "series". This PR breaks that contract currently as it runs APIs in parallel. Here's a good looking pattern for running Promises serially https://stackoverflow.com/a/42324940

Working today on landing #1503 which will probably cause some breaking changes you'll need to update this for.

Since this PR makes Gatsby require Promise support, we'll need to document this. To this point, Gatsby had tracked React's browser support i.e. IE9+. We need to decide also if we should provide a Promise polyfill by default. I'd lean towards yes given IE11 is still ~5% of (US) traffic and 3% of global.

navigator.serviceWorker.getRegistrations().then(registrations => {
for (let registration of registrations) {
registration.unregister()
// Troubles with this import in the past?
Copy link
Contributor

Choose a reason for hiding this comment

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

This is because es6/commonjs modules work differently.

let NextRoot = require(`./root`)

if (NextRoot.default) {

Copy link
Contributor

Choose a reason for hiding this comment

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

is the Github diff display being weird or is there really spaces between all these lines? If so, those need removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies, some of my local formatting sneaking in, I'll strip them out.

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Aug 7, 2017

Definitely. I've done this pattern in ptotoculture as all service providers similarly boot in series.

Want me to wait until the other change lands? This has been fairly trivial to add.

@KyleAMathews
Copy link
Contributor

Go ahead with the docs plus promise polyfill. Not sure yet exactly how the other PR will affect this one.

@KyleAMathews
Copy link
Contributor

  • restoring running things in serial.

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Aug 8, 2017

Updated, ready for another look.

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Getting close! Thanks for the great work!

@@ -1,7 +1,22 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll also need to update the doc-links.yaml file with the new link.

@@ -1,7 +1,22 @@
---
title: Browserslist
title: Browser Support
---

Copy link
Contributor

Choose a reason for hiding this comment

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

Add/replace the text at the start saying "Gatsby supports the same browsers as the stable version of React.js which is currently IE9+ as well as the most recent versions of other popular browsers. Gatsby requires support for the Promise API which is not supported in older browsers. Because of this, Gatsby…"

@@ -40,6 +40,11 @@ module.exports = (state = {}, action) => {
action = _.set(action, [`payload`, `pathPrefix`], ``)
}

// Default polyfill to true.
if (!_.has(action, `polyfill`)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be on the payload.

@KyleAMathews
Copy link
Contributor

Looked at gatsbyjs.org's preview build for this PR and saw a bunch of errors

https://deploy-preview-1735--gatsbyjs.netlify.com/

screen shot 2017-08-09 at 9 45 04 am

@jquense
Copy link
Contributor

jquense commented Aug 9, 2017

I wonder if that's related to what I was seeing on a site...I was having no luck getting webpacks DefinePlugin to insert anything. May be completely unrelated!

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Aug 9, 2017

Yeah, I've been trying to figure out if these tests are giving false negatives or not as things seem to still be working locally. If I have to do anything for them, let me know.

@KyleAMathews
Copy link
Contributor

Looks like the gatsbyjs.org isn't erroring anymore but the layout isn't being added

@atrauzzi
Copy link
Contributor Author

@KyleAMathews - Hey, sorry. Not to nag, but is there anything you're waiting for on this one? GitHub still seems to be showing "changes requested", although I have updated my branch with the changes you asked for last.

@KyleAMathews KyleAMathews merged commit 859aaf1 into gatsbyjs:master Aug 18, 2017
@KyleAMathews
Copy link
Contributor

Thanks for your work here!

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Aug 18, 2017

Hey, sorry. Not to nag, but is there anything you're waiting for on this one? GitHub still seems to be showing "changes requested".

I have to manually change the status of my review and since I hadn't had time to review things the status was still the same.

Please understand that your PRs and issues are not always going to reviewed quickly. It doesn't mean you're doing anything wrong it just means I have other stuff going on that doesn't always allow me to spend the hours it takes to review and land PRs. So comments like this and asking on Discord are very much nagging and I would appreciate you just assume that your PR will get reviewed and landed ASAP and wait patiently until then.

We'd love to have more maintainers to speed up landing PRs and I'm perfectly willing to mentor you and others who want to level up to being able to maintain parts of Gatsby but in the meantime, sometimes things will be a bit choppy.

@atrauzzi
Copy link
Contributor Author

No problems, I definitely wasn't intending it. More just trying to be prompt in accommodating your suggestions - promise!

Thank you so much!

@KyleAMathews
Copy link
Contributor

I do appreciate that :-)

@KyleAMathews
Copy link
Contributor

But to be clear. I don't expect y'all to be prompt necessarily either. Often this isn't your job or whatever so please don't feel guilty if you don't have time to finish something up. If it's that important then someone else will pick it up sooner or later.

@atrauzzi atrauzzi deleted the topics/async-browser-plugins branch November 25, 2017 16:15
@jlengstorf
Copy link
Contributor

Hiya @atrauzzi! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

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.

6 participants