I was under the impression that if any reactive variables used within getMeteorData
change, then getMeteorData
will fire off. But I’m getting stuck in an infinite loop for some reason, and I don’t see how it’s happening. I’m using meteorflux:dispatcher
BTW.
I’ve got a dashboard which will run a query to Salesforce but only if we’re connected to the service.
Dashboard = React.createClass({
displayName: 'Dashboard',
mixins: [ReactMeteorData],
getMeteorData() {
if (Store.isSfConnected()) {
Dispatcher.dispatch({
action: 'USER_REQUESTED_DATA_REFRESH'
});
}
return {
sfConnected: Store.isSfConnected(),
eventsList: Events.find({}, {sort: {StartDateTime: 1}}).fetch()
}
},
[...]
The only reactive variables that the USER_REQUESTED_DATA_REFRESH
function is modifying are these:
appState.set({
queryDone: false,
queryInProgress: true
});
[...]
Events.remove({}); // clear out any data first
_.sortBy(finalResults, 'StartDateTime').forEach(function (event) {
Events.insert(event);
});
[...]
appState.set({
queryDone: true,
queryInProgress: false
});
Events
is getting updated in a loop… but my console.log
statement in the dashboard that dumps the contents shows it’s already fully populated. And even if I remove Events.insert
, I’m still in a loop.
I’m stumped. I wish I could trace this better, and it’s too bad getMeteorData
can’t tell me which reactive state change triggered it. I’d step through the Chrome debugger, but I don’t want to step through all the guts of the Meteor library (Chrome’s blackboxing appears to be broken). How do I go about troubleshooting this?