Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

makeGeneric() is crashing my browser with 'Uncaught RangeError' #694

Closed Kiel-H-Byrne closed 6 years ago

Kiel-H-Byrne commented 7 years ago

I get this error: Uncaught RangeError: Maximum call stack size exceeded: aldeed_simple-schema.js?hash=13e803e…:170 at String.replace (<anonymous>) at makeGeneric (aldeed_simple-schema.js?hash=13e803e…:170) at parseObj (aldeed_simple-schema.js?hash=13e803e…:244) at aldeed_simple-schema.js?hash=13e803e…:291 at Function._.each._.forEach (underscore.js?hash=cde485f…:152) at parseObj (aldeed_simple-schema.js?hash=13e803e…:287) at aldeed_simple-schema.js?hash=13e803e…:291 at Function._.each._.forEach (underscore.js?hash=cde485f…:152) at parseObj (aldeed_simple-schema.js?hash=13e803e…:287) at aldeed_simple-schema.js?hash=13e803e…:291

My App utilizes a 'Listings' Collection and a 'Categories' Collection: the Listings Collection has a 'category' field that matches one of the categories in the collection. this is all reactive; so that when we ADD a 'Listing', and select a 'category', the count increases in the 'Categories' collection.

Listings Schema to match: categories: { type: [String], label: 'Categories', optional: true } and a form to display it; {{> afFormGroup name="" type="select-checkbox-inline" options=formOptions}}

with a helper to grab the names: formOptions: function() { return Categories.find().map(function(c) { return {label: c.name, value: c.name}; }); }

I only get the issue when i submit the form on the browser AND select a category. (submit form works if no category is selected) I am able to insert the document with a "Listings.insert(...)" into the Browser Dev console; even with an array of categories.

Any ideas what makeGeneric is trying to trim?

aldeed commented 7 years ago

That's an odd place to get that error. Call stack errors can be impacted by how you've structured your code and your template, for example if you have any weird or excessive nesting. I'm not sure how to debug this further unless you can make it happen in a simple reproduction app.

If you can update to latest ss/c2/autoform, there is a good chance that might fix it, too.

Kiel-H-Byrne commented 7 years ago

Thanks for the speedy reply @aldeed. I'm going to update the autoform package first and try again. It started randomly. and it only affects one value of my collection. i.e. i have a "Listings" collection with business info. it has a "Categories" field which is of type [String] and if i omit this field from the autoform, i don't get an error. when i include it again. i get a stack.

I'll post some snippets later as well if the update doesn't fix.

aldeed commented 6 years ago

The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following: