node-ddp-client icon indicating copy to clipboard operation
node-ddp-client copied to clipboard

Collection Observer

Open lancygoyal opened this issue 9 years ago • 5 comments

after subscribing the collection the when we register a observer it says "underfined is not a functiuon" ios simulator screen shot 17-sep-2015 2 45 10 pm

lancygoyal avatar Sep 17 '15 09:09 lancygoyal

I'm seeing the exact same error. Seems to be a bug in the mini-mongo implementation? Is there any workaround?

scottsykora avatar Sep 28 '15 02:09 scottsykora

Actually, looking into this a little further, it seems you need to 'polyFill' the process.nextTick to get minimongo-cache to work in react native. See: https://github.com/petehunt/minimongo-cache

To fix it you need to add the following to the top of your react native js (before creating the ddp client):

if (typeof this.process === 'undefined') {
  process = {};
  process.nextTick = setImmediate;
}

scottsykora avatar Sep 28 '15 02:09 scottsykora

Thanks @scottsykora You saved me several hours!

hobbyexplorer avatar Jan 19 '16 00:01 hobbyexplorer

@scottsykora what if process is not undefined, do you also need to set process.nextTick = setImmediate; ?

Taakn avatar Jan 29 '16 16:01 Taakn

@Taakn I'm not sure. If it's already defined then it should be an object that has nextTick defined, but if you're having issues you could give it a try. The above was really just a hack to get my implementation working, the core issue should probably be fixed in the library itself in a more robust way.

scottsykora avatar Jan 29 '16 18:01 scottsykora