Multiple Tabs Opened Wrong Subscriptions

I have two pages, one being a details page of a job and another being a list page (showing all jobs). If I have 1 tab open to the details page, all is good. Now if I open a second tab and go to the list page, I am also grabbing the job data but the data only contains the needed fields to show the list (so that I can grab 25 jobs much faster). The list page works just fine.

Now if I leave the tab open at the list page and I click on the other tab to go back to the job details page, the subscription for the job detail information hits again (hits every time you go from one tab to another), but the data that comes in instead of having all fields of data like it should for the detail page, it only has the fields that are needed on the list page. So now my job detail page only has a tiny bit of information (and tons of errors until I put ifs around everything), the subscriptions are getting confused on which tabs need which data.

How can I fix this? Both pages are using the same subscription, Jobs.find({_id: id}); but one of them has fields and the other doesn’t. Why when going back to the detail page is it still using the subscription from the list even though its a different tab?

I am using Angular 5, METEOR@1.6 and have tried on OSX. Same bug in both versions. I am using MeteorObservable subscriptions.

I’m afraid more info is needed. A reproduction is probably best if possible.

I will put one together right now.

Finally figured out the problem. My Job collection was part of a grounddb collection, which made the localstorage share the data between tabs. Removing the grounddb from the collection works as expected.

1 Like