Skip to content

fix(vue): expose countlyGlobal on Vue prototype (24.05 backport)#7659

Merged
ar2rsawseen merged 1 commit into
release.24.05from
fix/vue-countlyglobal-prototype-24.05
Jun 4, 2026
Merged

fix(vue): expose countlyGlobal on Vue prototype (24.05 backport)#7659
ar2rsawseen merged 1 commit into
release.24.05from
fix/vue-countlyglobal-prototype-24.05

Conversation

@ar2rsawseen

Copy link
Copy Markdown
Member

Summary

Backport of #7658 to release.24.05.

With the dev/warning Vue build (frontend.production=false), any dashboard template that references countlyGlobal (e.g. :src="countlyGlobal.path + ...">) throws during render — [Vue warn]: Property or method "countlyGlobal" is not defined + TypeError: Cannot read properties of undefined (reading 'path'). Vue 2's render proxy doesn't fall through to window for template-expression identifiers, so countlyGlobal is undefined (it only "worked" in the minified build via with(this)). The (countlyGlobal.path || '') form doesn't help since countlyGlobal.path is evaluated first.

Fix: in frontend/express/public/javascripts/countly/vue/core.js, expose it once on Vue.prototype via a getter (always reflects the current window.countlyGlobal), right after Vue.prototype.$route = .... Covers every template referencing countlyGlobal across core and all plugins (they share this Vue instance). No per-component shims; JS-file uses unaffected.

node --check passes; eslint clean. Minified /min/ bundles are rebuilt by CI (grunt dist-all); only the source change is committed.

🤖 Generated with Claude Code

Backport of #7658 to release.24.05. countlyGlobal is a window-level
global, but Vue 2's render proxy (dev/warning build,
frontend.production=false) does not fall through to window for template
expression identifiers, so a bare countlyGlobal.* in a .html binding
resolves to undefined and throws during render (only "worked" in the
minified build). Expose it once on Vue.prototype via a getter, covering
every dashboard template across core and all plugins.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 10:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR backports the Vue 2 dev-build fix to release.24.05 by making the window.countlyGlobal global available to Vue template expressions via the Vue prototype, preventing render-time undefined errors and Vue warnings in non-minified builds.

Changes:

  • Adds a Vue.prototype.countlyGlobal getter that returns window.countlyGlobal.
  • Documents why template expressions can’t reliably access window globals in Vue 2’s dev/proxy build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ar2rsawseen ar2rsawseen merged commit a3ca9bc into release.24.05 Jun 4, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants