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

Checking query params raises error #164

Closed
delgermurun opened this issue Jun 14, 2015 · 8 comments
Closed

Checking query params raises error #164

delgermurun opened this issue Jun 14, 2015 · 8 comments

Comments

@delgermurun
Copy link
Contributor

check(FlowRouter.current().queryParams, {}) (on page with empty query string).

Raises Match error: Expected plain object.

Checking with fields (e.g. check(FlowRouter.current().queryParams, {page: String})) raises error too.

@arunoda
Copy link
Contributor

arunoda commented Jun 14, 2015

So, this is something on server right?
may be related to #163

Do you have any fix in mind?

@arunoda
Copy link
Contributor

arunoda commented Jun 14, 2015

I think that's okay. Since null || undefined is not what check expects for?
Is this a bug anyway?

@delgermurun
Copy link
Contributor Author

It is on client. On server it works fine (passing subscriptions's second arg).

It was working fine, but I don't remember when it popped up. Maybe after triggers release.

Yeah, it is bug. I haven't solution yet. My workaround is cloning query params :).
check(_.clone(FlowRouter.current().queryParams), {}) it works fine.

I guess it is related to #163.

@arunoda
Copy link
Contributor

arunoda commented Jun 14, 2015

I'm confused.
Where do you use check on the client?
I'd like to have sample case?

@delgermurun
Copy link
Contributor Author

Just copy & paste check(FlowRouter.current().queryParams, {}) into web console on page with empty query string.

I've shared code that works on client & server. That's why I'm checking on client.

@delgermurun
Copy link
Contributor Author

I find cause of this effect. It is because qs use Object.create(null), so query params doesn't have any properties. Here is commit that changed it ljharb/qs@211ba0f.

Refs: ljharb/qs#80, ljharb/qs#73

So what should we do?

@delgermurun
Copy link
Contributor Author

Here is error stack trace

Error: Match error: Expected plain object
    at checkSubtree (match.js:279)
    at check (match.js:32)

Error line: https://github.com/meteor/meteor/blob/devel/packages/check/match.js#L278

@arunoda
Copy link
Contributor

arunoda commented Jun 14, 2015

I think this is a bug in Meteor. That should boy check for constructor.
For now we can hack convert qs object to a normal object.
On 2015 ජූනි 14, ඉරිදා at පෙ.ව. 9.49 Delgermurun Purevkhuu <
notifications@github.com> wrote:

Here is error stack trace

Error: Match error: Expected plain object
at checkSubtree (match.js:279)
at check (match.js:32)

Error line:
https://github.com/meteor/meteor/blob/devel/packages/check/match.js#L278


Reply to this email directly or view it on GitHub
#164 (comment)
.

@arunoda arunoda added the bug label Jun 17, 2015
@arunoda arunoda removed the bug label Jun 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants