Skip to content

Commit c5c9912

Browse files
authored
Merge pull request #5851 from Countly/anna/master
[core] Do not fetch event model data if event is not selected
2 parents 77308b2 + f7b0ec6 commit c5c9912

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

frontend/express/public/javascripts/countly/countly.event.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,34 @@
8989
}))
9090
.then(
9191
function() {
92-
return $.when($.ajax({
93-
type: "GET",
94-
url: countlyCommon.API_PARTS.data.r,
95-
data: {
96-
"app_id": countlyCommon.ACTIVE_APP_ID,
97-
"method": "events",
98-
"event": _activeEvent,
99-
"segmentation": currentActiveSegmentation,
100-
"period": _period,
101-
"preventRequestAbort": true
102-
},
103-
dataType: "json",
104-
success: function(json) {
105-
if (currentActiveEvent === _activeEvent && currentActiveSegmentation === _activeSegmentation) {
106-
_activeLoadedEvent = _activeEvent;
107-
_activeLoadedSegmentation = _activeSegmentation;
108-
_activeEventDb = json;
109-
setMeta();
92+
if (_activeEvent) {
93+
return $.when($.ajax({
94+
type: "GET",
95+
url: countlyCommon.API_PARTS.data.r,
96+
data: {
97+
"app_id": countlyCommon.ACTIVE_APP_ID,
98+
"method": "events",
99+
"event": _activeEvent,
100+
"segmentation": currentActiveSegmentation,
101+
"period": _period,
102+
"preventRequestAbort": true
103+
},
104+
dataType: "json",
105+
success: function(json) {
106+
if (currentActiveEvent === _activeEvent && currentActiveSegmentation === _activeSegmentation) {
107+
_activeLoadedEvent = _activeEvent;
108+
_activeLoadedSegmentation = _activeSegmentation;
109+
_activeEventDb = json;
110+
setMeta();
111+
}
110112
}
111-
}
112-
})).then(function() {
113+
})).then(function() {
114+
return true;
115+
});
116+
}
117+
else {
113118
return true;
114-
});
119+
}
115120
}
116121
);
117122
}

0 commit comments

Comments
 (0)