Closed leite08 closed 6 years ago
OK, I will fix it ASAP...
@leite08 investigating...
Quick fix is:
import { check, Match } from 'meteor/check';
Meteor.publish('document.list', function(someId) {
check(someId, String);
check(arguments, [Match.Any]);
...
});
For some reason, when perak:joins is used, there is one extra argument to publication...
Try console.log(arguments);
at the beginning of publish function, and I got:
{ '0': '123', '1': 'NSTDppJad5tzFtkZS' }
Instead:
{ '0': '123' }
🤔
@leite08 Ah... OK, got it. That's normal behavior (now documented in README.md).
If { reactive: true }
is used then publication is called with one extra argument internaly used by the package - you need to check()
that extra argument too:
import { check, Match } from 'meteor/check';
Meteor.publish('document.list', function(someId, extraArgument) {
check(someId, String);
check(extraArgument, Match.Any);
...
});
Thanks again for perfect bug report! Beer for you: 🍺 (if you don't drink beer, please bring it back and I'll send you ice cream :D )
Cool @perak! Thanks for the fix! Will implement it ASAP!
Thanks for the beer, I surely liked it! :smiley:
Congrats for the package! Have a beer on me: :beer:
Upon testing the fix of #18 I've found this: when using Meteor's audit-argument-checks I got the exception below:
It only happens after the first update of the joined collection (Companies). After this first error occurs, the exception keeps poping up even after a restart. Only stops after a
meteor reset
(I know, new database, but the code is configured to clean & repopulate the collections upon start).To simulate this you can use this repo (
audit-argument-checks
is already installed):Clone the new branch:
git clone -b perak-joins-issue-missing-check git@github.com:leite08/Create-React-Meteor-App.git
Run:
cd Create-React-Meteor-App/ &&
meteor npm install --save react react-dom &&
meteor
On the browser:
http://localhost:3000/
It should run and show the home page.
Then you can run this database update, when the exception should be thrown:
db.companies.update({},{$set:{name:'aaa'}});