{"record":{"id":"f76c8c94a67d7f05","repo":"quasarframework/quasar","slug":"tried-to-remove-listeners-but-no-event-specified","errorCode":null,"errorMessage":"Tried to remove listeners but no event specified.","messagePattern":"Tried to remove listeners but no event specified\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":303,"sourceCode":"    }\n\n    if (typeof callback !== 'function') {\n      this.warn('Tried add listener but no valid callback function specified.')\n      return\n    }\n\n    const target = (this.listeners[event] ||= [])\n    target.push({ type: 'once', callback })\n    this.log(`Added a one-time listener for event: \"${event}\".`)\n  }\n\n  /**\n   * @param {string} event\n   * @param {(message: Message) => void} callback\n   */\n  off(event, callback) {\n    if (!event) {\n      this.warn('Tried to remove listeners but no event specified.')\n      return\n    }\n\n    const list = this.listeners[event]\n\n    if (list === void 0) {\n      this.warn(\n        `Tried to remove listener for \"${event}\" event but there is no such listener attached.`\n      )\n      return\n    }\n\n    if (callback === void 0) {\n      if (event.startsWith('@quasar:')) {\n        // ensure we don't remove internal listeners\n        this.listeners[event] = [list[0]]\n      } else {\n        delete this.listeners[event]","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L285-L321","documentation":"BexBridge.off(event, callback) was called with an empty/undefined/falsy event name. The bridge warns and removes nothing.","triggerScenarios":"bridge.off(undefined, handler) or bridge.off('', handler), often when the event name comes from a variable that is empty at teardown time.","commonSituations":"Cleanup code in component unmount where the event-name constant failed to import; storing event names in state that got cleared before cleanup runs.","solutions":["Pass the same non-empty string used at registration to off().","Persist the event name (module constant) rather than transient state for cleanup.","Skip the off() call when you know no listener was registered."],"exampleFix":"// before\nonUnmounted(() => bridge.off(eventName, handler)) // eventName lost\n// after\nconst EVENT = 'my-event'\nbridge.on(EVENT, handler)\nonUnmounted(() => bridge.off(EVENT, handler))","handlingStrategy":"validation","validationCode":"if (typeof event === 'string' && event.length > 0) {\n  bridge.off(event, handler)\n}","typeGuard":"const isValidEventName = (e) => typeof e === 'string' && e.trim().length > 0","tryCatchPattern":null,"preventionTips":["Use module-level constants for event names in cleanup code.","Don't store event names in transient component state.","Register and unregister in the same scope using the same constant."],"tags":["bex","extension","missing-argument","event-listener"],"backgroundTag":"missing-required-argument","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}