varvet / serenade.js

Client side MVC framework
http://serenadejs.org
Other
524 stars 27 forks source link

nesting of 20 is too deep #64

Closed rosenfeld closed 11 years ago

rosenfeld commented 12 years ago

I'm getting this exception in one of my views:

nesting of 20 is too deep
  (in /home/rodrigo/ecore/src/ruby/matterhorn/app/assets/javascripts/views/search/results.serenade)

json (1.7.3) lib/json/common.rb:155:in `parse'
json (1.7.3) lib/json/common.rb:155:in `parse'
multi_json (1.3.6) lib/multi_json/adapters/json_common.rb:7:in `load'
multi_json (1.3.6) lib/multi_json.rb:93:in `load'
execjs (1.4.0) lib/execjs/json.rb:7:in `decode'
execjs (1.4.0) lib/execjs/external_runtime.rb:62:in `extract_result'
execjs (1.4.0) lib/execjs/external_runtime.rb:28:in `block in exec'
execjs (1.4.0) lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
execjs (1.4.0) lib/execjs/external_runtime.rb:27:in `exec'
execjs (1.4.0) lib/execjs/external_runtime.rb:19:in `eval'
serenade_rails (0.2.0) lib/serenade_rails/template.rb:18:in `parse'

This deep level in my view is not that deep that it becomes hard to read the template. Actually having to split it just because of this limit will make it harder to understand. :(

jnicklas commented 12 years ago

Hmm, interesting. I wasn't aware of this limit.

rosenfeld commented 12 years ago

The 'json' Ruby gem has the same issue:

https://github.com/pivotalpodbay/jasmine-gem/commit/a3eccc3416dd2ab7063fb3b8bd1369b449439fe7

I don't know about ExecJS yet though.

rosenfeld commented 12 years ago

ExecJS don't allow the options to be passed to MultiJson and then to JSON:

https://github.com/sstephenson/execjs/blob/master/lib/execjs/json.rb

rosenfeld commented 12 years ago

It should somehow call MultiJson.load(obj, :max_nesting => false) or MultiJson.load(obj, ExecJS.json_options)

rosenfeld commented 12 years ago

I've just sent them a pull request:

https://github.com/sstephenson/execjs/pull/104

jnicklas commented 11 years ago

Just ran into this once again. Just adding yajl-ruby or some other JSON parser to the app solved the problem. Until/unless execjs and multijson fix this, there isn't anything we can do.