JackAdams / meteor-editable-text

Drop-in editable text widget for meteor
http://editable-text-demo.taonova.com
MIT License
59 stars 14 forks source link

Maximum call stack size exceeded #11

Open mjesuele opened 9 years ago

mjesuele commented 9 years ago

Hi all,

I am attempting to use editable-text to allow users to change the title of a "stream" (chat room). When clicked, the text turns into an input box as expected, but if the text is edited, I get this stack trace upon losing focus (or enter being pressed) and the input field does not revert to plain text. There is no error if the text is not edited, and the input field does revert.

Uncaught RangeError: Maximum call stack size exceeded     ejson.js:455
EJSON.clone                                               ejson.js:455
(anonymous function)                                      ejson.js:494
_.each._.forEach                                     underscore.js:113 

Those last three calls are repeated over and over. What is causing this recursive loop?

For reference, here is the Jade template:

template(name='messagesList')
  #messages
    h1
      +editableText(collection='streams' field='name')
    each messages
      +message

I am using the following versions:

babrahams:editable-text@0.7.11
ejson@1.0.5
meteor@1.1.4
meteor-platform@1.2.1
underscore@1.0.2

You can see the issue for yourself by going to my beta app, creating an account, creating a stream (using the text field on the left panel), and then clicking on the title 'New stream'.

Please let me know if there's any other helpful information I can provide.

JackAdams commented 9 years ago

Yes, there's definitely something going wrong with the editable text package. It looks like the click event is being fired in some kind of infinite loop, but I can't see how that would be happening without looking at the larger code context.

Any chance you could put up a minimal repro somewhere? I just put together a little test app (below) and it's working as expected:

JADE

head
  title test

body
  +doc

template(name='doc')
  with doc
    h1
      +editableText(collection='documents' field='title')

JS

Documents = new Mongo.Collection('documents');

if (Meteor.isClient) {

  Template.doc.helpers({
    doc: function () {
      return Documents.findOne();
    }
  });

}

if (Meteor.isServer) {

  Meteor.startup(function () {
    Documents.insert({title:"Test title"});
  });

}
mklueh commented 7 years ago

Why is this closed? I have the same issue, seems to be still unsolved

JackAdams commented 7 years ago

Is it jade or blaze that this is happening for @Mklueh ?

mklueh commented 7 years ago

It is Blaze