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:
parent
91decaf9fe
commit
5eb130b02a
|
@ -6,7 +6,6 @@ const AutoCompleteControl = require('./auto_complete_control.js');
|
||||||
|
|
||||||
class TagAutoCompleteControl extends AutoCompleteControl {
|
class TagAutoCompleteControl extends AutoCompleteControl {
|
||||||
constructor(input, options) {
|
constructor(input, options) {
|
||||||
const allTags = tags.getNameToTagMap();
|
|
||||||
const caseSensitive = false;
|
const caseSensitive = false;
|
||||||
const minLengthForPartialSearch = 3;
|
const minLengthForPartialSearch = 3;
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ class TagAutoCompleteControl extends AutoCompleteControl {
|
||||||
(a, b) => a.startsWith(b) :
|
(a, b) => a.startsWith(b) :
|
||||||
(a, b) => a.includes(b);
|
(a, b) => a.includes(b);
|
||||||
text = transform(text);
|
text = transform(text);
|
||||||
return Array.from(allTags.entries())
|
return Array.from(tags.getNameToTagMap().entries())
|
||||||
.filter(kv => match(transform(kv[0]), text))
|
.filter(kv => match(transform(kv[0]), text))
|
||||||
.sort((kv1, kv2) => {
|
.sort((kv1, kv2) => {
|
||||||
return kv2[1].usages - kv1[1].usages;
|
return kv2[1].usages - kv1[1].usages;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
const misc = require('./util/misc.js');
|
const misc = require('./util/misc.js');
|
||||||
const request = require('superagent');
|
const request = require('superagent');
|
||||||
|
|
||||||
let _tags = null;
|
let _tags = new Map();
|
||||||
let _categories = null;
|
let _categories = new Map();
|
||||||
let _stylesheet = null;
|
let _stylesheet = null;
|
||||||
|
|
||||||
function getTagByName(name) {
|
function getTagByName(name) {
|
||||||
|
|
Loading…
Reference in New Issue