From b4c0df32ccb1ee4d2c80e0295727df33e654e2b6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 26 Dec 2008 01:10:55 +0000 Subject: [PATCH] Fix one or two tag errors resulting from an uncleared cache --- chrome/content/zotero/xpcom/data/dataObjects.js | 5 +++++ chrome/content/zotero/xpcom/data/tags.js | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js index dbc472ea5d..5f9d648abb 100644 --- a/chrome/content/zotero/xpcom/data/dataObjects.js +++ b/chrome/content/zotero/xpcom/data/dataObjects.js @@ -104,6 +104,11 @@ Zotero.DataObjects = function (object, objectPlural, id, table) { this._objectCache[id] = store[id]; } + // If there's an internal reload hook, call it + if (this._reload) { + this._reload(ids) + } + // Reload data this._load(ids); diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js index e60450a3df..0085beff32 100644 --- a/chrome/content/zotero/xpcom/data/tags.js +++ b/chrome/content/zotero/xpcom/data/tags.js @@ -396,6 +396,14 @@ Zotero.Tags = new function() { } + /** + * Internal reload hook to clear cache + */ + this._reload = function (ids) { + _tags = {}; + } + + /** * Unload tags from caches * @@ -432,6 +440,7 @@ Zotero.Tags = new function() { sql += " AND tagID IN (" + Zotero.join(arguments[0], ",") + ")"; } var rows = Zotero.DB.query(sql); + var ids = []; for each(var row in rows) { var id = row.tagID;