From 779a9cea22495314d47073d498c42fb67a417c34 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 23 Jan 2020 14:42:43 +0000 Subject: [PATCH] topic_data: Use IntDict for stream_dict. All the callers seem to have integer stream_ids already, either from the message object or some sub object. We also use clear() inside the test-only reset() method. --- static/js/topic_data.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/topic_data.js b/static/js/topic_data.js index c69951050b..790a4c9b01 100644 --- a/static/js/topic_data.js +++ b/static/js/topic_data.js @@ -1,7 +1,7 @@ -const Dict = require('./dict').Dict; +const IntDict = require('./int_dict').IntDict; const FoldDict = require('./fold_dict').FoldDict; -let stream_dict = new Dict(); // stream_id -> topic_history object +const stream_dict = new IntDict(); // stream_id -> topic_history object exports.stream_has_topics = function (stream_id) { if (!stream_dict.has(stream_id)) { @@ -201,7 +201,7 @@ exports.get_recent_names = function (stream_id) { exports.reset = function () { // This is only used by tests. - stream_dict = new Dict(); + stream_dict.clear(); }; window.topic_data = exports;