Meteor 2.0 Async and AutoForm

In trying to use the new Async functions in my application, next to Blaze impact, I also discovered AutoForm can not work with this : many patterns are broken now.
E.g. returning a schema from a helper function is common practice. If that schema helper has to become async because you are fetching data (say to populate some options for a field), this breaks the AutoForm package.
Either AutoForm has to (substantially) reworked or Blaze has to offer a way of passing the resolved results to AutoForm ?

@jkuester this is something to look into.

@polygonwood can you share a short code snippet that shows how it’s actually broken?

@jkeuster I can provide a code snippet if you want but it’s fairly simple: AutoForm expects a schema object as schema parameter, when you pass a Promise it breaks.

in html you can have something like

{#autoForm schema=mySchema type=normal ...}}

in client code you will find helper to deliver the schema :

mySchema() {
    return new SimpleSchema({
        myField : {
            type: String,
            options : () => {
                let options = Collection.find({ ...}).fetch();
                return options.map(...);
            }
        }
    });
}

changing the fetch() to a fetchAsync() forces the helper to become async which breaks AutoForm

1 Like