kwishnu kwishnu - 4 months ago 39
Android Question

How do I change Meteor server-side data and re-publish to React Native app?

I am trying to set up Meteor as a back-end server for a React Native (so far just Android) app, and have used React Native Meteor Boilerplate as a starting point, in which I set up the server on a local port, then connect to it on the device. While the Meteor client/server interface is very dynamic, I'm confused as to why the app doesn't update with changes to the server code. For instance:

var seed = () => {
if (Details.find().count() === 0) {
for (let i = 0; i < 10; i++) {
name: `Detail #${i}`
. . .

displays in the app a listview of items Detail #0, Detail #1, etc. But if I change this code, say by deleting the word 'Detail,' the app momentarily shows a loading icon, but then re-displays the same list...even if I restart the server and/or log out and back in to the app.

How do I change the data on the server so that it is reflected on the app? Is it cached somehow so that my changes aren't shown? Thanks in advance


If your listview is showing you items from the Details collection, and there are items in it, Details.find().count() === 0 evaluates to false, so the collection is not actually changing.
I suspect that is why you state that it 're-displays the same list'

An easy way to debug what is happening with your collections is to use the Meteor Shell, where you can add, delete, or modify items in your collections while observing what happens on the client.