Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between .find.watch and .find.fetch #622

Closed
mlucy opened this issue Jun 29, 2016 · 7 comments
Closed

Inconsistency between .find.watch and .find.fetch #622

mlucy opened this issue Jun 29, 2016 · 7 comments

Comments

@mlucy
Copy link
Member

mlucy commented Jun 29, 2016

When I write this:

hz('test').find(0).watch().subscribe(msg => console.log(msg))

It prints null.

But when I write this:

hz('test').find(0).fetch().subscribe(msg => console.log(msg))

It prints nothing. If I use findAll instead both watch and fetch print []. Ping @Tryneus because he said it might be a bug.

@mlucy mlucy added the bug label Jun 29, 2016
@deontologician deontologician added this to the First post-2.0 release milestone Jun 29, 2016
@deontologician
Copy link
Contributor

@mlucy Can you capture the protocol stuff for these two commands? I would tentatively guess either we aren't receiving a complete, or we're mishandling it in the client

@mlucy
Copy link
Member Author

mlucy commented Jun 29, 2016

@deontologician --

4{"type":"subscribe","options":{"collection":"test","find":{"id":0}},"request_id":2}
4{"state":"synced","request_id":2}
4{"type":"query","options":{"collection":"test","find":{"id":0}},"request_id":3}
4{"data":[],"state":"complete","request_id":3}
4{"request_id":3,"type":"end_subscription"}

(The first is for watch, the second is for fetch.)

@deontologician
Copy link
Contributor

Ok, looks like a client error as suspected

@marshall007
Copy link
Contributor

The issue is with this line in client/src/index.js#L121 because Observable.from([]) isn't going to emit any values. Shouldn't we expect { "data": [null], ... } in the response for a find with no results?

@marshall007
Copy link
Contributor

marshall007 commented Jun 29, 2016

Looks like server behavior was changed here: a2dcd5f#diff-860203edebb57e95b7530efa657e58e6L71

@deontologician
Copy link
Contributor

Awesome, thanks @marshall007

@deontologician deontologician modified the milestones: Release 2.0, First post-2.0 release Jun 29, 2016
deontologician pushed a commit that referenced this issue Jul 20, 2016
@deontologician
Copy link
Contributor

Fix up for this in #652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants