SDA-3705 - Render network error once (#1425)

This commit is contained in:
Kiran Niranjan 2022-05-19 08:00:25 +05:30 committed by GitHub
parent abd538bfa0
commit 2f2b1f8d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

18
package-lock.json generated
View File

@ -4426,7 +4426,7 @@
"dependencies": {
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
}
@ -5226,7 +5226,7 @@
},
"css-value": {
"version": "0.0.1",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/css-value/-/css-value-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/css-value/-/css-value-0.0.1.tgz",
"integrity": "sha1-Xv1sLupeof1rasV+wEJ7GEUkJOo=",
"dev": true
},
@ -5713,7 +5713,7 @@
},
"dev-null": {
"version": "0.1.1",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/dev-null/-/dev-null-0.1.1.tgz",
"resolved": "https://registry.npmjs.org/dev-null/-/dev-null-0.1.1.tgz",
"integrity": "sha1-WiBc48Ky73e2I41roXnrdMag6Bg=",
"dev": true
},
@ -11937,7 +11937,7 @@
},
"lodash.isobject": {
"version": "3.0.2",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.isobject/-/lodash.isobject-3.0.2.tgz",
"resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz",
"integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=",
"dev": true
},
@ -11989,7 +11989,7 @@
},
"lodash.zip": {
"version": "4.2.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/lodash.zip/-/lodash.zip-4.2.0.tgz",
"resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz",
"integrity": "sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=",
"dev": true
},
@ -12943,19 +12943,19 @@
"dependencies": {
"tr46": {
"version": "0.0.3",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/tr46/-/tr46-0.0.3.tgz",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=",
"dev": true
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=",
"dev": true
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/whatwg-url/-/whatwg-url-5.0.0.tgz",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"dev": true,
"requires": {
@ -15367,7 +15367,7 @@
"dependencies": {
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"dev": true
}

View File

@ -150,10 +150,14 @@ ipcRenderer.on('page-load-failed', (_event, { locale, resources }) => {
// Injects network error content into the DOM
ipcRenderer.on('network-error', (_event, { error }) => {
const networkErrorContainer = document.createElement('div');
networkErrorContainer.id = 'main-frame';
networkErrorContainer.classList.add('content-wrapper');
document.body.append(networkErrorContainer);
let networkErrorContainer = document.getElementById('main-frame');
// prevents duplicate rendering of the NetworkError
if (!networkErrorContainer) {
networkErrorContainer = document.createElement('div');
networkErrorContainer.id = 'main-frame';
networkErrorContainer.classList.add('content-wrapper');
document.body.append(networkErrorContainer);
}
const networkError = React.createElement(NetworkError, { error });
ReactDOM.render(networkError, networkErrorContainer);
});