In an attempt to control the cache on the client side, we had the idea of toggling the subscription to a specific Collection on and off by placing the Meteor.subscribe call within a reactive context as recommended in the Meteor documentation - "In addition, calling Meteor.subscribe in a reactive context sets up a subscription which is automatically stopped when the context is invalidated."
However, we encountered the error "Uncaught TypeError: Converting circular structure to JSON" repeatedly.
The sequence of events in our program goes like this:
Appliances = new Meteor.Collection 'appliances'
Alerts = new Meteor.Collection 'alerts'
On the client side
During Meteor.startup, we subscribe to the collection 'appliances'
Meteor.subscribe ('appliances')
We use Appliances.find{}.observe to track changes
When a new item in Appliances is detected, we dynamically subscribe to alerts using Meteor.render and display all alerts associated with that item
Meteor.render(function() {Meteor.subscribe(Alerts); .....}
Can you spot where I may have made a mistake? Open to any suggestions!