简体   繁体   中英

Meteor Template re-renders when Accounts.createUser throws error

So basically I have a template and within that template I have a template that renders a form. Attached to the form is a submit event that when triggered, validates the from data and calls Accounts.createUser.

In the case that Accounts.createUser throws an error it, for some unknown reason, causes the upper level template to re-render in turn the second level template re-renders thus removing the values in the form fields and discarding the errors that were inserted below each field using jquery.

If Accounts.createUser doesn't throw an error, everything works fine, user is "logged in" and the inner page is rendered properly..

Is this a bug in Meteor? I don't see why Accounts.createUser throwing an error would cause a template re-render..

1) Check all dependencies for the upper template. Does any of its data depend on createUser result? Double-check all Session variables.

2) Do you have a callback in the createUser call?

3) Try putting your form template within a {{#constant}} block. This should prevent rerendering and losing data. Also, if you use preserveInputs package, remember that input data is preserved only for inputs that have either id or name set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM