Remove bugsnag (#19)
This commit is contained in:
committed by
Tobias Miesel
parent
23c9af90b3
commit
fd04d6bf6c
@@ -5,7 +5,6 @@ import Bubble from "./components/Bubble"
|
||||
import Popup from "components/Popup"
|
||||
import { createServiceFinder } from "utils/urlMatcher"
|
||||
import remoteServices from "./remoteServices"
|
||||
import { ErrorBoundary } from "utils/notifier"
|
||||
import { ContentMessenger } from "utils/messaging"
|
||||
import "../css/content.scss"
|
||||
|
||||
@@ -35,26 +34,24 @@ chrome.runtime.onConnect.addListener(function(port) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<ErrorBoundary>
|
||||
<Transition
|
||||
native
|
||||
items={service}
|
||||
from={{ opacity: "0" }}
|
||||
enter={{ opacity: "1" }}
|
||||
leave={{ opacity: "0" }}
|
||||
config={config.stiff}
|
||||
>
|
||||
{service =>
|
||||
service &&
|
||||
// eslint-disable-next-line react/display-name
|
||||
(props => (
|
||||
<animated.div className="moco-bx-bubble" style={{ ...props, ...service.position }}>
|
||||
<Bubble key={service.url} bookedHours={bookedHours} />
|
||||
</animated.div>
|
||||
))
|
||||
}
|
||||
</Transition>
|
||||
</ErrorBoundary>,
|
||||
<Transition
|
||||
native
|
||||
items={service}
|
||||
from={{ opacity: "0" }}
|
||||
enter={{ opacity: "1" }}
|
||||
leave={{ opacity: "0" }}
|
||||
config={config.stiff}
|
||||
>
|
||||
{service =>
|
||||
service &&
|
||||
// eslint-disable-next-line react/display-name
|
||||
(props => (
|
||||
<animated.div className="moco-bx-bubble" style={{ ...props, ...service.position }}>
|
||||
<Bubble key={service.url} bookedHours={bookedHours} />
|
||||
</animated.div>
|
||||
))
|
||||
}
|
||||
</Transition>,
|
||||
document.getElementById("moco-bx-root"),
|
||||
)
|
||||
}
|
||||
@@ -67,9 +64,7 @@ chrome.runtime.onConnect.addListener(function(port) {
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<ErrorBoundary>
|
||||
<Popup ref={popupRef} {...payload} onRequestClose={closePopup} />
|
||||
</ErrorBoundary>,
|
||||
<Popup ref={popupRef} {...payload} onRequestClose={closePopup} />,
|
||||
document.getElementById("moco-bx-popup-root"),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import Options from './components/Options'
|
||||
import { ErrorBoundary } from 'utils/notifier'
|
||||
import '../css/options.scss'
|
||||
import React from "react"
|
||||
import ReactDOM from "react-dom"
|
||||
import Options from "./components/Options"
|
||||
import "../css/options.scss"
|
||||
|
||||
const domContainer = document.querySelector('#moco-bx-root')
|
||||
const domContainer = document.querySelector("#moco-bx-root")
|
||||
|
||||
ReactDOM.render(
|
||||
<ErrorBoundary>
|
||||
<Options />
|
||||
</ErrorBoundary>,
|
||||
domContainer
|
||||
)
|
||||
ReactDOM.render(<Options />, domContainer)
|
||||
|
||||
@@ -3,7 +3,6 @@ import ReactDOM from "react-dom"
|
||||
import App from "./components/App"
|
||||
import queryString from "query-string"
|
||||
import { parseProps } from "utils"
|
||||
import { ErrorBoundary } from "utils/notifier"
|
||||
import "../css/popup.scss"
|
||||
|
||||
const parsedProps = parseProps([
|
||||
@@ -21,12 +20,7 @@ const parsedProps = parseProps([
|
||||
"fromDate",
|
||||
"toDate",
|
||||
"errorType",
|
||||
"errorMessage"
|
||||
"errorMessage",
|
||||
])(queryString.parse(location.search))
|
||||
|
||||
ReactDOM.render(
|
||||
<ErrorBoundary>
|
||||
<App {...parsedProps} />
|
||||
</ErrorBoundary>,
|
||||
document.querySelector("#moco-bx-root")
|
||||
)
|
||||
ReactDOM.render(<App {...parsedProps} />, document.querySelector("#moco-bx-root"))
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import React from "react"
|
||||
import bugsnag from "@bugsnag/js"
|
||||
import bugsnagReact from "@bugsnag/plugin-react"
|
||||
import { includes } from "lodash/fp"
|
||||
|
||||
function getAppVersion() {
|
||||
try {
|
||||
return chrome.runtime.getManifest().version
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const filterReport = report => {
|
||||
const appVersion = getAppVersion()
|
||||
if (!appVersion) {
|
||||
return false
|
||||
}
|
||||
|
||||
const scripts = ["background", "content", "options", "popup"].map(
|
||||
file => `${chrome.extension.getURL(file)}.${appVersion}.js`
|
||||
)
|
||||
|
||||
return scripts.some(script => report.stacktrace.some(includes(script)))
|
||||
}
|
||||
|
||||
|
||||
// When BUGSNAG_API_KEY is undefined ErrorBoundary should simply render children
|
||||
let ErrorBoundary = ({ children }) => children
|
||||
|
||||
if (process.env.BUGSNAG_API_KEY) {
|
||||
const bugsnagClient = bugsnag({
|
||||
apiKey: process.env.BUGSNAG_API_KEY,
|
||||
appVersion: getAppVersion(),
|
||||
collectUserIp: false,
|
||||
beforeSend: filterReport,
|
||||
releaseStage: process.env.NODE_ENV,
|
||||
notifyReleaseStages: ["production"]
|
||||
})
|
||||
|
||||
bugsnagClient.use(bugsnagReact, React)
|
||||
ErrorBoundary = bugsnagClient.getPlugin("react")
|
||||
}
|
||||
|
||||
export { ErrorBoundary }
|
||||
Reference in New Issue
Block a user