diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-06-06 13:40:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-06 13:40:41 +0200 |
commit | 3dfc08bf4e170b80caa6b12910a76faf1cb6d59b (patch) | |
tree | 59fbce31f503128f06a82d7621f1ecaf0a18b438 | |
parent | Merge pull request #1469 from meetfranz/feature/check-for-updates-in-menu (diff) | |
parent | Improve cleanup code of invalid service references (diff) | |
download | ferdium-app-3dfc08bf4e170b80caa6b12910a76faf1cb6d59b.tar.gz ferdium-app-3dfc08bf4e170b80caa6b12910a76faf1cb6d59b.tar.zst ferdium-app-3dfc08bf4e170b80caa6b12910a76faf1cb6d59b.zip |
Merge pull request #1468 from meetfranz/fix/workspaces-ddos-on-invalid-service-reference
Fix invalid services references in workspaces locally
-rw-r--r-- | src/features/workspaces/store.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 51a7f3651..07b16ff23 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -312,17 +312,16 @@ export default class WorkspacesStore extends FeatureStore { | |||
312 | 312 | ||
313 | _cleanupInvalidServiceReferences = () => { | 313 | _cleanupInvalidServiceReferences = () => { |
314 | const { services } = this.stores; | 314 | const { services } = this.stores; |
315 | let invalidServiceReferencesExist = false; | 315 | const { allServicesRequest } = services; |
316 | const servicesHaveBeenLoaded = allServicesRequest.wasExecuted && !allServicesRequest.isError; | ||
317 | // Loop through all workspaces and remove invalid service ids (locally) | ||
316 | this.workspaces.forEach((workspace) => { | 318 | this.workspaces.forEach((workspace) => { |
317 | workspace.services.forEach((serviceId) => { | 319 | workspace.services.forEach((serviceId) => { |
318 | if (!services.one(serviceId)) { | 320 | if (servicesHaveBeenLoaded && !services.one(serviceId)) { |
319 | invalidServiceReferencesExist = true; | 321 | workspace.services.remove(serviceId); |
320 | } | 322 | } |
321 | }); | 323 | }); |
322 | }); | 324 | }); |
323 | if (invalidServiceReferencesExist) { | ||
324 | getUserWorkspacesRequest.execute(); | ||
325 | } | ||
326 | }; | 325 | }; |
327 | 326 | ||
328 | _stopPremiumActionsAndReactions = () => { | 327 | _stopPremiumActionsAndReactions = () => { |