Best way to cache client-side data across routes


#1

I’m building a Cordova app that presents CRUD operations around a list of Tickets. The home page presents the list and you can click on any list item for more details about a specific Ticket.

The home page is reached at / and presents a tickets template.
The ticket page is reached at /ticket/:_id and presents a ticket template.

The / route subscribes to all the tickets related to the current user (pagination coming soon). I’m assuming this data is cached client-side in minimongo.

When the user clicks to see more about a ticket, I’ve tried fetching new data via Tickets.findOne(Router.current().params._id). It works if I add a single ticket subscription to this route. It does not work if I get rid of the subscription.

This doesn’t make a lot of sense because the initial tickets subscription should cache all the visible tickets client-side in minimongo. When doing a Tickets.findOne(Router.current().params._id) – shouldn’t Meteor look to minimongo for that data without needing a new subscription?

I’m using GroundDB to ground collections and methods even if the app is offline. It works, but does not address subscriptions across routes.

Any suggestions on how best to cache data across routes to make the app snappy and reduce DB trips?