Here’s the parts of the script in question:
var eventId = 0;
this.Parameter.onValueChanged(module, function(param) {
eventId = param.eventId;
if (param.created != undefined) {
Created.value = param.created;
}
getEvent();
});
function getEvent() {
Loading.value = true;
UserContext.getStorageUser().then(function(User) {
EventContext.getEvent(eventId, User.id).then(function(result) {
Event = result;
EventObs.value = result;
attendanceStatus.value = result.my_attendance;
if (attendanceStatus.value == "host") {
isHost.value = true;
}
var ImgUrl = Event.img_url;
fileType = ImgUrl.split(".");
fileType = fileType[1];
if (fileType == "jpg") {
fileType = "jpeg";
}
ImageContext.UrlToBase64(ImgUrl, "true", "300", "200", fileType).then(function(Base64) {
EventImageBase64.value = Base64;
LoadingImage.value = false;
});
getMessages();
Loading.value = false;
});
});
}
function getMessages() {
EventContext.getMessages(eventId).then(function(result) {
console.log(result);
Messages.replaceAll(result);
});
}
GetEvent()
worked like a charm until I recently added GetMessages()
into the mix. Now after adding it, the code halts at the execution of GetMessages()
in GetEvent()
and throws this error:
Error: TypeError: Cannot read property 'eventId' of undefined: Name: TypeError: Cannot read property 'eventId' of undefined
Error message: Uncaught TypeError: Cannot read property 'eventId' of undefined
File name: Pages/EventPages/ViewEventPage.js
Line number: 29
Source line: eventId = param.eventId;
JS stack trace: TypeError: Cannot read property 'eventId' of undefined
at Pages/EventPages/ViewEventPage.js:29:17
at subscriber (fusejs/Observable.js:417:3)
at Subscriber.post (fusejs/Observable.js:550:16)
at fusejs/Observable.js:576:39
at PumpMessages (fusejs/Observable.js:1063:4)
at ProxyObservable.Observable._addSubscriber (fusejs/Observable.js:582:3)
at ProxyObservable.Observable.addSubscriber (fusejs/Observable.js:555:7)
at ProxyObservable.Observable._addDisposableSubscriber (fusejs/Observable.js:438:7)
at ProxyObservable.Observable.onValueChanged (fusejs/Observable.js:423:8)
at Object._tempMethod (Pages/EventPages/ViewEventPage.js:28:16)
in Fuse.Reactive.JavaScript+DiagnosticSubject<Pages/EventPages/ViewEventPage.js:29>
eventId
is not used or manipulated any other places in the script and does not seem to have anything to do with it. When removing GetMessages()
from GetEvent()
or gut GetMessages()
of its contents it works perfectly. I find this very strange and confusing since using eventId
works fine in GetEvent()
…
The new Fuse ‘player’ has been very unstable and freezes a lot as well as being a bit slower at reacting to file changes. When doing UX changes it usually refreshes 3-4 times and sometimes gets stuck in a loop. I recently had another mysterious UX error which eventually was resolved by simply quitting and restarting the player. Can the player be responsible for this error or am I missing something?
Thanks in advance.