Clarify debug lines for tag selector updating

This commit is contained in:
Dan Stillman 2019-03-18 04:52:48 -04:00
parent b2d5b9a2f3
commit 67febb2f45
2 changed files with 5 additions and 2 deletions

View file

@ -30,9 +30,11 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
this.selectedTags = new Set();
this.state = defaults;
}
// Update trigger #1 (triggered by ZoteroPane)
async onItemViewChanged({collectionTreeRow, libraryID, tagsInScope}) {
Zotero.debug('Updating tag selector from current view');
this.collectionTreeRow = collectionTreeRow || this.collectionTreeRow;
let newState = {loaded: true};
@ -51,6 +53,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
async notify(event, type, ids, extraData) {
if (type === 'setting') {
if (ids.some(val => val.split('/')[1] == 'tagColors')) {
Zotero.debug("Updating tag selector after tag color change");
let tagColors = Zotero.Tags.getColors(this.libraryID);
this.state.tagColors = tagColors;
this.setState({tagColors, tags: await this.getTags(null, tagColors)});
@ -93,6 +96,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
// TODO: Check libraryID for some events to avoid refreshing unnecessarily on sync changes?
Zotero.debug("Updating tag selector after tag change");
var newTags = await this.getTags();
if (type == 'item-tag' && event == 'remove') {

View file

@ -1156,7 +1156,6 @@ var ZoteroPane = new function()
this.setTagScope = async function () {
var collectionTreeRow = self.getCollectionTreeRow();
if (self.tagSelectorShown()) {
Zotero.debug('Updating tag selector with current tags');
if (collectionTreeRow.editable) {
ZoteroPane_Local.tagSelector.setMode('edit');
}