-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Using Collection Hook's direct
version breaks defaultValue
and autoValue
on an insert
#452
Comments
Thank you for submitting this issue! We, the Members of Meteor Community Packages take every issue seriously. However, we contribute to these packages mostly in our free time. If you think this issue is trivial to solve, don't hesitate to submit Please also consider sponsoring the maintainers of the package. |
Hi @evolross thanks for the reporting. If on Collection2@3.5.0 plus NPM simple schema, can you please use Just to see if the issue is really related to simple schema or collection 2. This is because |
So yes, using I'm thinking it has something to do with load ordering of |
Upon some thought, I thought for sure this was a load order issue with I moved For As I thought, the collection hook As a sanity check, I changed the repo back to |
So my original configuration has the same load order as the new configuration, but the original configuration works. I am noticing that in the new configuration simple-schema's validate is not being called which is the problem. I just don't know why it's not being called. |
Describe the bug
Ran into an issue upgrading my project to Meteor 2.16 from 2.7.2 (on my way up to 3.0).
When using
aldeed:collection2@4.0.2
with the includedaldeed:simple-schema@1.13.1
on a Meteor 2.16 project along withmatb33:collection-hooks@1.3.1
(latest version), using the collection hook'sdirect
versions that bypass a collection's hook will cause thedefaultValue
andautoValue
set in the schema to also not run. The added logic in the defined simple schema gets bypassed and the document gets inserted/updated as if simple schema doesn't exist. I have testedmatb33:collection-hooks
and it seems the problem is rooted inaldeed:collection2
oraldeed:simple-schema
. If you drop back down toaldeed:collection2@3.5.0
and usemeteor npm install simpl-schema@1.12.3
with any version ofmatb33:collection-hooks
all works as expected.To Reproduce
I've hotrodded the React Simple Todos demo to display the error in a repo here.
The repo has the following currently added:
Start the repo with the
meteor
command.A link will be inserted in the list without using the
direct
version in theinsert
. Theinsert
is performed and the link'sdescription
andcreatedAt
are all successfully set using either Simple Schema'sdefaultValue
orautoValue
. You'll also notice the link'slinkType
is updated to "video" by the defined and workingLinksCollection.before.insert
hook.A link will be inserted in the list using the
direct
version in theinsert
. Theinsert
is performed but the link will not get any of the Simple Schema logic (e.g.defaultValue
orautoValue
) however it does get inserted. And the hook is not performed so itslinkType
is still "website".Expected behavior
Making use of a
matb33:collection-hook
direct
call should still run the Simple Schema logic (e.g.defaultValue
orautoValue
) and validation. Usingaldeed:collection2@3.5.0
andmeteor npm install simpl-schema@1.12.3
all works as expected. Feel free to comment outaldeed:collection2
and uncommentaldeed:collection2@3.5.0
in thepackages.js
file and then do ameteor npm install simpl-schema@1.12.3
and then update theimport
inlinks.js
to see it working correctly on the prior versions.The text was updated successfully, but these errors were encountered: