diff options
author | 2022-05-15 01:44:18 -0500 | |
---|---|---|
committer | 2022-05-15 19:05:55 -0500 | |
commit | 082b64b6c40fcab3ecf303f53ce83e7753894a32 (patch) | |
tree | 92626869949cc671effce89cfbcd52092243de5c /src/stores/ServicesStore.js | |
parent | fix: revert "Typescript conversion" (#153) (diff) | |
download | ferdium-app-082b64b6c40fcab3ecf303f53ce83e7753894a32.tar.gz ferdium-app-082b64b6c40fcab3ecf303f53ce83e7753894a32.tar.zst ferdium-app-082b64b6c40fcab3ecf303f53ce83e7753894a32.zip |
Extract utility functions for JSON parsing
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index c8042e9de..3f551eddb 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -16,6 +16,7 @@ import { | |||
16 | } from '../helpers/recipe-helpers'; | 16 | } from '../helpers/recipe-helpers'; |
17 | import { workspaceStore } from '../features/workspaces'; | 17 | import { workspaceStore } from '../features/workspaces'; |
18 | import { DEFAULT_SERVICE_SETTINGS, KEEP_WS_LOADED_USID } from '../config'; | 18 | import { DEFAULT_SERVICE_SETTINGS, KEEP_WS_LOADED_USID } from '../config'; |
19 | import { cleanseJSObject } from '../jsUtils'; | ||
19 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 20 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
20 | import { ferdiumVersion } from '../environment-remote'; | 21 | import { ferdiumVersion } from '../environment-remote'; |
21 | 22 | ||
@@ -861,7 +862,7 @@ export default class ServicesStore extends Store { | |||
861 | const service = this.one(serviceId); | 862 | const service = this.one(serviceId); |
862 | 863 | ||
863 | // Make sure the args are clean, otherwise ElectronJS can't transmit them | 864 | // Make sure the args are clean, otherwise ElectronJS can't transmit them |
864 | const cleanArgs = JSON.parse(JSON.stringify(args)); | 865 | const cleanArgs = cleanseJSObject(args); |
865 | 866 | ||
866 | if (service.webview) { | 867 | if (service.webview) { |
867 | service.webview.send(channel, cleanArgs); | 868 | service.webview.send(channel, cleanArgs); |
@@ -1273,9 +1274,7 @@ export default class ServicesStore extends Store { | |||
1273 | 1274 | ||
1274 | if (service.webview) { | 1275 | if (service.webview) { |
1275 | // We need to completely clone the object, otherwise Electron won't be able to send the object via IPC | 1276 | // We need to completely clone the object, otherwise Electron won't be able to send the object via IPC |
1276 | const shareWithWebview = JSON.parse( | 1277 | const shareWithWebview = cleanseJSObject(service.shareWithWebview); |
1277 | JSON.stringify(service.shareWithWebview), | ||
1278 | ); | ||
1279 | 1278 | ||
1280 | debug('Initialize recipe', service.recipe.id, service.name); | 1279 | debug('Initialize recipe', service.recipe.id, service.name); |
1281 | service.webview.send( | 1280 | service.webview.send( |