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

feat(gatsby-script): On error callback #35466

Merged
merged 3 commits into from
Apr 21, 2022

Conversation

tyhopp
Copy link
Contributor

@tyhopp tyhopp commented Apr 21, 2022

Description

Implements the ability to use an onError callback for scripts with sources. Usage looks like:

<Script
  src={scripts.three}
  strategy={ScriptStrategy.postHydrate}
  onError={(event: Event) => { console.log(`Hello world`) }}
/>

Limitations
The onError callback works only for scripts with sources using the post-hydrate or idle strategies. It does not work with inline scripts.

Documentation

To be included in a later PR(s).

Related Issues

[sc-49066]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 21, 2022
@tyhopp tyhopp changed the base branch from master to feat-script-component April 21, 2022 13:38
@tyhopp tyhopp added topic: performance Related to runtime & build performance type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 21, 2022
@tyhopp tyhopp added this to the Script Component milestone Apr 21, 2022
@tyhopp tyhopp mentioned this pull request Apr 21, 2022
12 tasks
@tyhopp tyhopp merged commit 7cc9ad3 into feat-script-component Apr 21, 2022
@tyhopp tyhopp deleted the feat-script-component-on-error-callback branch April 21, 2022 13:51
tyhopp added a commit that referenced this pull request May 9, 2022
* feat(gatsby-script): On error callback

* test(gatsby-script): Update on error callback e2e test logic

* chore(gatsby-script): Skip inline scripts gatsby link nav test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) topic: performance Related to runtime & build performance type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant