From ebf3b46f0dd990fa1277a0947914367b34519cee Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:50:43 +0530 Subject: [PATCH] fix: TypeError cannot read properties of undefined (reading '$store') (#9777) This issue is an extremely narrow edge case that does not affect the app functionality. It occurs here 1. `executeRecurringNotification` is the method that sets a timeout of 30 seconds and pings as required 2. This method is triggered when one of the following events happen `click`, `touchstart`, `keypress`, `keydown` 3. The class in question is initalized before the Vue app is mounted in `application.js`, the vue app is mounted on `window.onload` event 4. In a case where the Vue app is not created (i.e. `window.onload` event is not fired) within 30 seconds of a user input, this error occurs. --- .../helper/AudioAlerts/DashboardAudioNotificationHelper.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js b/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js index 724fd18cf..d9899b374 100644 --- a/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js +++ b/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js @@ -52,6 +52,10 @@ class DashboardAudioNotificationHelper { }; executeRecurringNotification = () => { + if (!window.WOOT || !window.WOOT.$store) { + this.clearSetTimeout(); + return; + } const mineConversation = window.WOOT.$store.getters.getMineChats({ assigneeType: 'me', status: 'open',