client/tags: blind fix for tags.json race

I don't want to make the UI wait for tags.json to load, I'd rather not
color categories on some pages instead.
This commit is contained in:
rr- 2016-09-16 21:34:38 +02:00
parent 91decaf9fe
commit 5eb130b02a
2 changed files with 3 additions and 4 deletions

View file

@ -6,7 +6,6 @@ const AutoCompleteControl = require('./auto_complete_control.js');
class TagAutoCompleteControl extends AutoCompleteControl {
constructor(input, options) {
const allTags = tags.getNameToTagMap();
const caseSensitive = false;
const minLengthForPartialSearch = 3;
@ -22,7 +21,7 @@ class TagAutoCompleteControl extends AutoCompleteControl {
(a, b) => a.startsWith(b) :
(a, b) => a.includes(b);
text = transform(text);
return Array.from(allTags.entries())
return Array.from(tags.getNameToTagMap().entries())
.filter(kv => match(transform(kv[0]), text))
.sort((kv1, kv2) => {
return kv2[1].usages - kv1[1].usages;

View file

@ -3,8 +3,8 @@
const misc = require('./util/misc.js');
const request = require('superagent');
let _tags = null;
let _categories = null;
let _tags = new Map();
let _categories = new Map();
let _stylesheet = null;
function getTagByName(name) {