silentrob / superscript-editor

NOT MAINTAINED - A Editor for authoring chatbots with SuperScript
MIT License
27 stars 16 forks source link

Assigning topic crashes the editor #29

Open siddharthg opened 9 years ago

siddharthg commented 9 years ago

When I add a gambit to a newly created topic, it crashes the node and give me the following error. I could reproduce the same multiple types.

/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/lib/topics/sort.js:108
        var kind_sorted = Object.keys(track[ip][kind]).sort(function(a,b) { re
                                               ^
TypeError: Cannot read property 'qtype' of undefined
    at Object.exports.sortTriggerSet (/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/lib/topics/sort.js:108:48)
    at /Users/siddharthgupta/git/superscript-editor/node_modules/superscript/lib/topics/topic.js:70:26
    at /Users/siddharthgupta/git/superscript-editor/node_modules/superscript/node_modules/async/lib/async.js:240:13
    at async.each (/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/node_modules/async/lib/async.js:114:20)
    at _asyncMap (/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/node_modules/async/lib/async.js:234:9)
    at Object.map (/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/node_modules/async/lib/async.js:212:23)
    at model.topicSchema.methods.sortGambits (/Users/siddharthgupta/git/superscript-editor/node_modules/superscript/lib/topics/topic.js:69:11)
    at Immediate.<anonymous> (/Users/siddharthgupta/git/superscript-editor/controllers/gambits.js:140:25)
    at Immediate._onImmediate (/Users/siddharthgupta/git/superscript-editor/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
    at processImmediate [as _immediateCallback] (timers.js:367:17)
silentrob commented 9 years ago

Im having a hard time reproducing this. I can see the problem is related to sorting gambits within a topic, are you sorting them by dragging and dropping them or clicking the sort button.

Are you adding the gambit though the normal form or the chat / quick add form?

mariusursache commented 9 years ago

Editor crashing when sorting happened to me previously, too, but only after deleting some gambits in the topic.

siddharthg commented 9 years ago

I am adding this gambit through the home page of the editor, that just happens once I add a new gambit to a newly created topic, anything I should try to fix this thing?

mariusursache commented 9 years ago
  1. Did you delete ANY gambit?
  2. In case you did, try clearing the whole database, and try to create a new gambit or more, then see if the above problem still happens.