Index: resources/celerity/map.php =================================================================== --- resources/celerity/map.php +++ resources/celerity/map.php @@ -14,7 +14,7 @@ 'differential.pkg.js' => '322ea941', 'diffusion.pkg.css' => '3783278d', 'diffusion.pkg.js' => '7b51e80a', - 'javelin.pkg.js' => 'c7ef4e11', + 'javelin.pkg.js' => '133881a7', 'maniphest.pkg.css' => 'f1887d71', 'maniphest.pkg.js' => '1e8f11af', 'rsrc/css/aphront/aphront-bars.css' => '231ac33c', @@ -208,12 +208,12 @@ 'rsrc/externals/javelin/lib/__tests__/behavior.js' => 'c1d75ee6', 'rsrc/externals/javelin/lib/behavior.js' => '8a3ed18b', 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '1c1a6cdf', - 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => 'd99e27f7', + 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => 'caab854b', 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => '5f850b5c', - 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => 'dbd9cd11', + 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '0136cec1', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '7383383f', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadPreloadedSource.js' => 'e9b95df3', - 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js' => '5e18d309', + 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js' => '62e18640', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => 'c2b8bf64', 'rsrc/externals/raphael/g.raphael.js' => '40dde778', 'rsrc/externals/raphael/g.raphael.line.js' => '40da039e', @@ -642,12 +642,12 @@ 'javelin-resource' => '356de121', 'javelin-stratcom' => 'c293f7b9', 'javelin-tokenizer' => '1c1a6cdf', - 'javelin-typeahead' => 'd99e27f7', - 'javelin-typeahead-composite-source' => 'dbd9cd11', + 'javelin-typeahead' => 'caab854b', + 'javelin-typeahead-composite-source' => '0136cec1', 'javelin-typeahead-normalizer' => '5f850b5c', 'javelin-typeahead-ondemand-source' => '7383383f', 'javelin-typeahead-preloaded-source' => 'e9b95df3', - 'javelin-typeahead-source' => '5e18d309', + 'javelin-typeahead-source' => '62e18640', 'javelin-typeahead-static-source' => 'c2b8bf64', 'javelin-uri' => 'd9a9b862', 'javelin-util' => '7501647b', @@ -799,6 +799,12 @@ ), 'requires' => array( + '0136cec1' => + array( + 0 => 'javelin-install', + 1 => 'javelin-typeahead-source', + 2 => 'javelin-util', + ), '029a133d' => array( 0 => 'aphront-dialog-view-css', @@ -1163,13 +1169,6 @@ 3 => 'javelin-stratcom', 4 => 'javelin-vector', ), - '5e18d309' => - array( - 0 => 'javelin-install', - 1 => 'javelin-util', - 2 => 'javelin-dom', - 3 => 'javelin-typeahead-normalizer', - ), '5f004630' => array( 0 => 'javelin-behavior', @@ -1191,6 +1190,13 @@ 2 => 'javelin-util', 3 => 'phabricator-shaped-request', ), + '62e18640' => + array( + 0 => 'javelin-install', + 1 => 'javelin-util', + 2 => 'javelin-dom', + 3 => 'javelin-typeahead-normalizer', + ), '63f9ad59' => array( 0 => 'javelin-install', @@ -1677,6 +1683,13 @@ 0 => 'javelin-install', 1 => 'javelin-util', ), + 'caab854b' => + array( + 0 => 'javelin-install', + 1 => 'javelin-dom', + 2 => 'javelin-vector', + 3 => 'javelin-util', + ), 'cd9e7094' => array( 0 => 'javelin-behavior', @@ -1760,13 +1773,6 @@ 7 => 'phabricator-dropdown-menu', 8 => 'phabricator-menu-item', ), - 'd99e27f7' => - array( - 0 => 'javelin-install', - 1 => 'javelin-dom', - 2 => 'javelin-vector', - 3 => 'javelin-util', - ), 'd9a9b862' => array( 0 => 'javelin-install', @@ -1785,12 +1791,6 @@ 0 => 'javelin-behavior', 1 => 'javelin-dom', ), - 'dbd9cd11' => - array( - 0 => 'javelin-install', - 1 => 'javelin-typeahead-source', - 2 => 'javelin-util', - ), 'dd7e8ef5' => array( 0 => 'javelin-behavior', Index: webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js =================================================================== --- webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js +++ webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js @@ -230,10 +230,28 @@ * in response to events from the datasource you have configured. * * @task control - * @param list List of #### tags to show as suggestions/results. + * @param list List of #### tags to show as suggestions/results. + * @param string The query this result list corresponds to. * @return void */ - showResults : function(results) { + showResults : function(results, value) { + if (value != this._value) { + // This result list is for an old query, and no longer represents + // the input state of the typeahead. + + // For example, the user may have typed "dog", and then they delete + // their query and type "cat", and then the "dog" results arrive from + // the source. + + // Another case is that the user made a selection in a tokenizer, + // and then results returned. However, the typeahead is now empty, and + // we don't want to pop it back open. + + // In all cases, just throw these results away. They are no longer + // relevant. + return; + } + var obj = {show: results}; var e = this.invoke('show', obj); Index: webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js =================================================================== --- webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js +++ webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js @@ -50,9 +50,9 @@ } }, - childResultsReady : function(nodes) { + childResultsReady : function(nodes, value) { this.results = this.mergeResults(this.results || [], nodes); - this.invoke('resultsready', this.results); + this.invoke('resultsready', this.results, value); }, childComplete : function() { Index: webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js =================================================================== --- webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js +++ webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js @@ -292,7 +292,7 @@ this.filterAndSortHits(value, hits); var nodes = this.renderNodes(value, hits); - this.invoke('resultsready', nodes); + this.invoke('resultsready', nodes, value); if (!partial) { this.invoke('complete'); }