{"action":"created","issue":{"url":"https://api.github.com/repos/ichord/At.js/issues/395","repository_url":"https://api.github.com/repos/ichord/At.js","labels_url":"https://api.github.com/repos/ichord/At.js/issues/395/labels{/name}","comments_url":"https://api.github.com/repos/ichord/At.js/issues/395/comments","events_url":"https://api.github.com/repos/ichord/At.js/issues/395/events","html_url":"https://github.com/ichord/At.js/issues/395","id":150533237,"number":395,"title":"Two listeners + Two API calls doesn't work","user":{"login":"jeekca","id":9212627,"avatar_url":"https://avatars.githubusercontent.com/u/9212627?v=3","gravatar_id":"","url":"https://api.github.com/users/jeekca","html_url":"https://github.com/jeekca","followers_url":"https://api.github.com/users/jeekca/followers","following_url":"https://api.github.com/users/jeekca/following{/other_user}","gists_url":"https://api.github.com/users/jeekca/gists{/gist_id}","starred_url":"https://api.github.com/users/jeekca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeekca/subscriptions","organizations_url":"https://api.github.com/users/jeekca/orgs","repos_url":"https://api.github.com/users/jeekca/repos","events_url":"https://api.github.com/users/jeekca/events{/privacy}","received_events_url":"https://api.github.com/users/jeekca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-23T08:43:12Z","updated_at":"2016-04-24T18:57:21Z","closed_at":null,"body":"I have the weirdest bug right now. I've checked and re-checked everything 100 times.\r\n\r\nI assign 2 listeners to a form. 1 fetches users with the \"@\" symbol, the other fetches events with the \"event:\" text.\r\n\r\nThe \"tagUsersConfig\" one works great, but the \"tagEventsConfig\" behaves weirdly. It fetches the first 5 events, then as soon as I start typing the first letter, the list dissapears, even if I know for a fact (in the console) that for each character I type, it's sending me back json objects from the API (all of which are accurate depending on the typed letter).\r\n\r\nIf I paste the users' API query in the tagEventsConfig (events) one, the \"event:\" now works. The weirdest part is (and you're going to have to take my word for it), the events API call and its variables are all perfectly correct and valid.\r\n\r\nThank you very much for your time.\r\n\r\n```javascript\r\n    var userList;\r\n    var eventList;\r\n\r\n    var tagUsersConfig = {\r\n      at: \"@\",\r\n      displayTpl: \"<li class='replyToAtWho-list-item clearfix'><div class='feed-replyTo-img' style='${imageId}'></div><div class='left'><div class='feed-replyTo-name'>${name}</div><div class='feed-replyTo-realName'>${realName}</div></div></li>\",\r\n      insertTpl: '<span class=\"feed-reply-to-name-link\" data-userNameReplyTo=\"${name}\" data-userIdReplyTo=\"${userId}\">${name}</span>&nbsp;',\r\n      callbacks: {\r\n        remoteFilter: function(query, render_users) {\r\n\r\n          $.getJSON(DOMAIN + '/Skeddy/rest/gem/v1/user?institutionid='+CAMPUS_ID+'&apitoken='+USER_TOKEN+'&limit=10&fullname=' + encodeURIComponent(query), function(data) {\r\n\r\n            userList = $.map(data.listT, function(value, i) {\r\n              var imageId = (parse_OBJ(value.i, \"ImageId\")) ? DOMAIN + '/Skeddy/rest/gem/v1/image/' + parse_OBJ(value.i, \"ImageId\") + '?sname=CampusSchema&apitoken=' + USER_TOKEN : '/' + ROOT + '/img/avatar-default.png';\r\n              return {\r\n                'userId': value.id,\r\n                'realName': value.name,\r\n                'name': parse_OBJ(value.i, \"firstName\") + \" \" + parse_OBJ(value.i, \"lastName\"),\r\n                'imageId' : 'background-image : url(\"' + imageId + '\")'\r\n              };\r\n            });\r\n\r\n            render_users(userList);\r\n\r\n          });\r\n        },\r\n        matcher: function(flag, subtext, should_start_with_space) {\r\n          var match, regexp;\r\n          flag = flag.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\r\n          if (should_start_with_space) {\r\n            flag = '(?:^|\\\\s)' + flag;\r\n          }\r\n          regexp = new RegExp(flag + '([A-Za-z0-9_\\\\s\\+\\-\\]*)$|' + flag + '([^\\\\x00-\\\\xff]*)$', 'gi');\r\n          match = regexp.exec(subtext.replace(/\\s/g, \" \"));\r\n          if (match) {\r\n            return match[2] || match[1];\r\n          } else {\r\n            return null;\r\n          }\r\n        }\r\n      },\r\n      delay: 20\r\n    };\r\n\r\n    var tagEventsConfig = {\r\n      at: \"event:\",\r\n      displayTpl: \"<li class='itemAtWho-list-item clearfix'><div class='feed-item-img' style='${imageId}'></div><div class='left'><div class='feed-item-name'>${eventName}</div><div class='feed-replyTo-realName'>10-10</div></div></li>\",\r\n      insertTpl: '<a href=\"' + DOMAIN + '/website/event-details/' + CAMPUS_ID + '/${eventId}\" class=\"fp-ext-link\" target=\"_blank\">${eventName}</span>&nbsp;',\r\n      callbacks: {\r\n        remoteFilter: function(query, render_events) {\r\n\r\n          $.getJSON(DOMAIN + '/Skeddy/rest/gem/v1/event?institutionid='+CAMPUS_ID+'&apitoken='+USER_TOKEN+'&limit=10&state=published_expired&name=' + encodeURIComponent(query), function(data) {\r\n\r\n            eventList = $.map(data.listT, function(value, i) {\r\n              var imageId = (value.imageId) ? DOMAIN + '/Skeddy/rest/gem/v1/image/' + value.imageId + '?sname=CampusSchema&apitoken=' + USER_TOKEN : '/' + ROOT + '/img/avatar-default.png';\r\n              return {\r\n                'eventId': value.eventId,\r\n                'eventName': value.name,\r\n                'imageId' : 'background-image : url(\"' + imageId + '\")'\r\n              };\r\n            });\r\n\r\n            render_events(eventList);\r\n\r\n          });\r\n        },\r\n        matcher: function(flag, subtext, should_start_with_space) {\r\n          var match, regexp;\r\n          flag = flag.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\r\n          if (should_start_with_space) {\r\n            flag = '(?:^|\\\\s)' + flag;\r\n          }\r\n          regexp = new RegExp(flag + '([A-Za-z0-9_\\\\s\\+\\-\\]*)$|' + flag + '([^\\\\x00-\\\\xff]*)$', 'gi');\r\n          match = regexp.exec(subtext.replace(/\\s/g, \" \"));\r\n          if (match) {\r\n            return match[2] || match[1];\r\n          } else {\r\n            return null;\r\n          }\r\n        }\r\n      },\r\n      delay: 20\r\n    };\r\n\r\n    $POST_FORM_MASTER.find(\".feed-form.mention\").atwho(tagEventsConfig).atwho(tagUsersConfig);\r\n```"},"comment":{"url":"https://api.github.com/repos/ichord/At.js/issues/comments/214022842","html_url":"https://github.com/ichord/At.js/issues/395#issuecomment-214022842","issue_url":"https://api.github.com/repos/ichord/At.js/issues/395","id":214022842,"user":{"login":"jeekca","id":9212627,"avatar_url":"https://avatars.githubusercontent.com/u/9212627?v=3","gravatar_id":"","url":"https://api.github.com/users/jeekca","html_url":"https://github.com/jeekca","followers_url":"https://api.github.com/users/jeekca/followers","following_url":"https://api.github.com/users/jeekca/following{/other_user}","gists_url":"https://api.github.com/users/jeekca/gists{/gist_id}","starred_url":"https://api.github.com/users/jeekca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeekca/subscriptions","organizations_url":"https://api.github.com/users/jeekca/orgs","repos_url":"https://api.github.com/users/jeekca/repos","events_url":"https://api.github.com/users/jeekca/events{/privacy}","received_events_url":"https://api.github.com/users/jeekca/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T18:57:21Z","updated_at":"2016-04-24T18:57:21Z","body":"This is what I have right now (after trying to merge both codes) : \r\n\r\n```\r\n        matcher: function(flag, subtext, should_start_with_space) {\r\n          var match, regexp;\r\n          flag = flag.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\r\n          if (should_start_with_space) {\r\n            flag = '(?:^|\\\\s)' + flag;\r\n          }\r\n          regexp = new RegExp(flag + '([a-zA-Z\\u00c0-\\u00ff0-9_,\\'\\.\\+\\-]*)$|' + flag + '([^\\\\x00-\\\\xff]*)$', 'gi');\r\n          match = regexp.exec(subtext.replace(/\\s/g, \" \"));\r\n          subtext.match(regexp);\r\n          if (match) {\r\n            return match[2] || match[1];\r\n          } else {\r\n            return null;\r\n          }\r\n        }\r\n```\r\n\r\nUnfortunately doesn't work. Still closes unexpectedly when typing \"event:Fo...\"."}}