After making some edits to another file and increasing the complexity of my application, a tracker function that was previously working fine is now experiencing issues. It is no longer returning any data for
vrLoan
fundingData
This is a snippet of my code:
Tracker.autorun(()=>{ // Tracker function for reactivity
const id = Session.get('data')._id;
const loans = Loans.find({fileId: id});
loans.forEach(o=>{
const vrLoan = VRLoans.find({parentId: o._id});
const fundingData = Funding.find({parentId: o._id});
const t = o.Type;
const n = o.description;
if(t && n && vrLoan.count() && fundingData.count()){
console.log("here")
fundDep.changed();
fundingNameSpace[t] = {};
if(t == "Bank Loan" || t == "Directors Loan" || t == "Lease" || t == "Loan Out/Invesment"){
fundingNameSpace[t][n] = new LoanCalc(t, vrLoan, fundingData);
}else if(t == "Share"){
fundingNameSpace[t][n] = new ShareCapCalc(vrLoan, fundingData);
}else if(t == "Other"){
fundingNameSpace[t][n] = new OtherIncomeCalc(vrLoan, fundingData);
}else if(t == "Cap"){
fundingNameSpace[t][n] = new CapitalGrantCalc(vrLoan, fundingData);
}
});
});
It seems that the additional code I implemented may have caused a slowdown in the query process, resulting in a length of 0 for the queries.
I would appreciate it if someone could help explain why this issue is occurring.