fix(vue): expose countlyGlobal on Vue prototype (24.05 backport)#7659
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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.countlyGlobalgetter that returnswindow.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.
pnrgenc
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #7658 to
release.24.05.With the dev/warning Vue build (
frontend.production=false), any dashboard template that referencescountlyGlobal(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 towindowfor template-expression identifiers, socountlyGlobalisundefined(it only "worked" in the minified build viawith(this)). The(countlyGlobal.path || '')form doesn't help sincecountlyGlobal.pathis evaluated first.Fix: in
frontend/express/public/javascripts/countly/vue/core.js, expose it once onVue.prototypevia a getter (always reflects the currentwindow.countlyGlobal), right afterVue.prototype.$route = .... Covers every template referencingcountlyGlobalacross core and all plugins (they share this Vue instance). No per-component shims; JS-file uses unaffected.node --checkpasses; eslint clean. Minified/min/bundles are rebuilt by CI (grunt dist-all); only the source change is committed.🤖 Generated with Claude Code