From 2bf5d1c2ea191ac19cd3e39426c39ab19db50ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Tue, 4 Sep 2018 12:29:00 +0200 Subject: [PATCH 01/11] Document payload size for javascript SDK --- src/collections/_documentation/clients/javascript/config.md | 4 +++- src/collections/_documentation/clients/javascript/usage.md | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/collections/_documentation/clients/javascript/config.md b/src/collections/_documentation/clients/javascript/config.md index c9e7cf35378e4..827701a38a6e6 100644 --- a/src/collections/_documentation/clients/javascript/config.md +++ b/src/collections/_documentation/clients/javascript/config.md @@ -299,12 +299,14 @@ Those configuration options are documented below: : `fetch()` init parameters ([https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)). + Setting `keepalive: true` parameter will allow SDK to send events in `unload` and `beforeunload` handlers. + However, it'll also restrict the size of a single event to 64kB, per [fetch specification](https://fetch.spec.whatwg.org/#http-network-or-cache-fetch) (point 8.5). + Defaults: ```javascript { method: 'POST', - keepalive: true, referrerPolicy: 'origin' } ``` diff --git a/src/collections/_documentation/clients/javascript/usage.md b/src/collections/_documentation/clients/javascript/usage.md index 77fc94f9d2bb6..d13959462b44e 100644 --- a/src/collections/_documentation/clients/javascript/usage.md +++ b/src/collections/_documentation/clients/javascript/usage.md @@ -127,6 +127,10 @@ The `captureMessage`, `captureException`, `context`, and `wrap` functions all al Raven.setTagsContext(tags); // Add back the tags you want to keep. ``` +**Be aware of maximal payload size** - There are times, when you want to send a whole application state as an extra data. +This can be quite a large object, which can easily weigh more than 200kB, which is currently maximamal payload size of a single event sent to Sentry. +When this happens, you'll get an `HTTP Error 413 Payload Too Large` as the server response or (when `keepalive: true` is set as `fetch` parameter) request will stay in `pending` state forever (eg. in Chrome). + `extra` : Arbitrary data to associate with the event. From a0ed9539fad19c08ee7212f171d2f3c2166f67bd Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 09:23:20 -0700 Subject: [PATCH 02/11] Handle empty search --- src/_js/lib/Search.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/_js/lib/Search.js b/src/_js/lib/Search.js index f3e2b5282796f..5f0c8e01b9836 100644 --- a/src/_js/lib/Search.js +++ b/src/_js/lib/Search.js @@ -24,8 +24,10 @@ const renderResult = function(data) { const renderResults = function(results, query) { const $results = $('[data-search-results]').clone(); - if (!results.length) { - $results.append(`

No results matching "${query}"

`); + if (!results || !results.length) { + const msg = `No results${!!results ? `matching "${query}"` : ''}`; + console.log(msg); + $results.append(`

${msg}

`); } $.each(results, function(i, result) { $results.append(renderResult(result)); @@ -53,8 +55,11 @@ class Search { init() { const params = qs.parse(location.search); - if (!params.q) return Promise.resolve(); - + if (!params.q) { + return Promise.resolve().then(() => { + $('[data-search-results]').append(renderResults()); + }); + } $('input[name="q"]').val(params.q); return this.Lunr.search(params.q).then(results => { From a7acd70b11d315aba731170c10b1e2c15f053369 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 09:25:33 -0700 Subject: [PATCH 03/11] remove log --- src/_js/lib/Search.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/_js/lib/Search.js b/src/_js/lib/Search.js index 5f0c8e01b9836..3eb2300fb3f3f 100644 --- a/src/_js/lib/Search.js +++ b/src/_js/lib/Search.js @@ -26,7 +26,6 @@ const renderResults = function(results, query) { const $results = $('[data-search-results]').clone(); if (!results || !results.length) { const msg = `No results${!!results ? `matching "${query}"` : ''}`; - console.log(msg); $results.append(`

${msg}

`); } $.each(results, function(i, result) { From 0105a991e870d07e99fb306deab12225a6d70db0 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 09:33:52 -0700 Subject: [PATCH 04/11] Fix: broken link to angular error handler docs Fixes # --- .../_documentation/clients/javascript/integrations/angular.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collections/_documentation/clients/javascript/integrations/angular.md b/src/collections/_documentation/clients/javascript/integrations/angular.md index acb4ed7596aa5..1c9ea27d50120 100644 --- a/src/collections/_documentation/clients/javascript/integrations/angular.md +++ b/src/collections/_documentation/clients/javascript/integrations/angular.md @@ -5,7 +5,7 @@ sidebar_order: 7 This document uses Angular to refer to Angular 2+. On its own, Raven.js will report any uncaught exceptions triggered from your application. For advanced usage examples of Raven.js, please read [_Raven.js usage_]({%- link _documentation/clients/javascript/usage.md -%}). -Additionally, Raven.js can be configured to catch any Angular-specific (2.x) exceptions reported through the [@angular/core/ErrorHandler](https://angular.io/docs/js/latest/api/core/index/ErrorHandler-class.html) component. +Additionally, Raven.js can be configured to catch any Angular-specific (2.x) exceptions reported through the [@angular/core/ErrorHandler](https://angular.io/api/core/ErrorHandler) component. ## TypeScript Support From 426583bd95cb4ddef94792a784b1c88258343697 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 09:44:08 -0700 Subject: [PATCH 05/11] fix: switch to jsx highlighting for react docs --- .../_documentation/clients/javascript/integrations/react.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/collections/_documentation/clients/javascript/integrations/react.md b/src/collections/_documentation/clients/javascript/integrations/react.md index e2b40f6540df1..fb317a6494e67 100644 --- a/src/collections/_documentation/clients/javascript/integrations/react.md +++ b/src/collections/_documentation/clients/javascript/integrations/react.md @@ -26,7 +26,7 @@ At this point, Raven is ready to capture any uncaught exception. If you’re using React 16 or above, [Error Boundaries](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) are an important tool for defining the behavior of your application in the face of errors. Be sure to send errors they catch to Sentry using `Raven.captureException`, and optionally this is also a great opportunity to surface [User Feedback]({%- link _documentation/learn/user-feedback.md -%}) -```javascript +```jsx class ExampleBoundary extends Component { constructor(props) { super(props); @@ -58,7 +58,7 @@ class ExampleBoundary extends Component { } ``` -```javascript +```html

Sidebar

From d80f97ce01c6be39f5061a3428a3058f840557a9 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 09:51:35 -0700 Subject: [PATCH 06/11] Add a space --- src/_js/lib/Search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_js/lib/Search.js b/src/_js/lib/Search.js index 3eb2300fb3f3f..d82ea6a763253 100644 --- a/src/_js/lib/Search.js +++ b/src/_js/lib/Search.js @@ -25,7 +25,7 @@ const renderResult = function(data) { const renderResults = function(results, query) { const $results = $('[data-search-results]').clone(); if (!results || !results.length) { - const msg = `No results${!!results ? `matching "${query}"` : ''}`; + const msg = `No results${!!results ? ` matching "${query}"` : ''}`; $results.append(`

${msg}

`); } $.each(results, function(i, result) { From 4fe8d5aeac779f8c08492176bdffec3a8f13380b Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Tue, 4 Sep 2018 13:04:16 -0700 Subject: [PATCH 07/11] build: Increase timeout --- cloudbuild.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 6b1e0cc7a5611..5f6547e2215ce 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -33,3 +33,4 @@ images: [ 'us.gcr.io/$PROJECT_ID/$REPO_NAME:latest', 'us.gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA', ] +timeout: 20m From 49c9b693fd229f487fc18e9a49e3e519697a4a4d Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 13:39:33 -0700 Subject: [PATCH 08/11] Remove twitter, linkedin, bing --- src/_js/lib/Trackers.js | 54 ----------------------------------------- src/_js/lib/Tracking.js | 3 --- 2 files changed, 57 deletions(-) diff --git a/src/_js/lib/Trackers.js b/src/_js/lib/Trackers.js index 5ea2e69bc7eda..32c5d8e4dc4a0 100644 --- a/src/_js/lib/Trackers.js +++ b/src/_js/lib/Trackers.js @@ -1,26 +1,3 @@ -export const twitter = function() { - const img1 = document.createElement('img'); - img1.src = - 'https://analytics.twitter.com/i/adsct?txn_id=nydby&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0'; - img1.setAttribute('height', '1'); - img1.setAttribute('width', '1'); - img1.setAttribute('style', 'display:none;'); - img1.setAttribute('alt', ''); - img1.setAttribute('aria-hidden', 'true'); - - const img2 = document.createElement('img'); - img2.src = - '//t.co/i/adsct?txn_id=nydby&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0'; - img2.setAttribute('height', '1'); - img2.setAttribute('width', '1'); - img2.setAttribute('style', 'display:none;'); - img2.setAttribute('alt', ''); - img2.setAttribute('aria-hidden', 'true'); - - document.body.appendChild(img1); - document.body.appendChild(img2); -}; - export const facebook = function() { const img = document.createElement('img'); img.src = @@ -33,37 +10,6 @@ export const facebook = function() { document.body.appendChild(img); }; -export const linkedin = function() { - window._linkedin_data_partner_id = '107517'; - const s = document.getElementsByTagName('script')[0]; - const b = document.createElement('script'); - b.type = 'text/javascript'; - b.async = true; - b.src = 'https://snap.licdn.com/li.lms-analytics/insight.min.js'; - s.parentNode.insertBefore(b, s); -}; - -export const bing = function() { - (function(w, d, t, r, u) { - var f, n, i; - (w[u] = w[u] || []), - (f = function() { - var o = { ti: '5751143' }; - (o.q = w[u]), (w[u] = new UET(o)), w[u].push('pageLoad'); - }), - (n = d.createElement(t)), - (n.src = r), - (n.async = 1), - (n.onload = n.onreadystatechange = function() { - var s = this.readyState; - (s && s !== 'loaded' && s !== 'complete') || - (f(), (n.onload = n.onreadystatechange = null)); - }), - (i = d.getElementsByTagName(t)[0]), - i.parentNode.insertBefore(n, i); - })(window, document, 'script', '//bat.bing.com/bat.js', 'uetq'); -}; - export const hubspot = function() { const script = document.createElement('script'); script.setAttribute('src', '//js.hs-scripts.com/3344477.js'); diff --git a/src/_js/lib/Tracking.js b/src/_js/lib/Tracking.js index 6c901ce9e3845..47754bd2850c0 100644 --- a/src/_js/lib/Tracking.js +++ b/src/_js/lib/Tracking.js @@ -4,10 +4,7 @@ const init = function() { const namespace = 'trackersOk'; loadIfTrackersOk.push(google); - loadIfTrackersOk.push(twitter); loadIfTrackersOk.push(facebook); - loadIfTrackersOk.push(linkedin); - loadIfTrackersOk.push(bing); loadIfTrackersOk.push(hubspot); // If we've been given permission to track, set a cookie that we can check From 398900ed8eba3ef984e1c26c8c1a036577a3fd38 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 4 Sep 2018 14:10:54 -0700 Subject: [PATCH 09/11] fix (ui): broken layout on certain pages due to flexbox --- src/_layouts/doc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_layouts/doc.html b/src/_layouts/doc.html index 86a2e78e22cc0..4a1f60215c6a1 100644 --- a/src/_layouts/doc.html +++ b/src/_layouts/doc.html @@ -4,7 +4,7 @@
-