tags
This commit is contained in:
@@ -155,7 +155,13 @@
|
|||||||
postid,
|
postid,
|
||||||
existingTags: tags,
|
existingTags: tags,
|
||||||
anchorEl: anchor,
|
anchorEl: anchor,
|
||||||
onSubmit: async (tag) => post("/api/v2/tags/" + postid, { tagname: tag }),
|
onSubmit: async (tag) => {
|
||||||
|
const res = await post("/api/v2/tags/" + postid, { tagname: tag });
|
||||||
|
if (res.success && window.invalidateItemCache) {
|
||||||
|
window.invalidateItemCache(postid);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
renderTags
|
renderTags
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6973,6 +6973,19 @@ window.cancelAnimFrame = (function () {
|
|||||||
// Export loaders for external systems (like NotificationSystem)
|
// Export loaders for external systems (like NotificationSystem)
|
||||||
window.loadPageAjax = loadPageAjax;
|
window.loadPageAjax = loadPageAjax;
|
||||||
window.loadItemAjax = loadItemAjax;
|
window.loadItemAjax = loadItemAjax;
|
||||||
|
|
||||||
|
// Invalidate all itemCacheMap entries that contain a given item ID.
|
||||||
|
// Call this after mutating an item (e.g. adding a tag) so the next
|
||||||
|
// AJAX navigation fetches fresh HTML instead of serving stale cache.
|
||||||
|
window.invalidateItemCache = (itemId) => {
|
||||||
|
if (!itemId) return;
|
||||||
|
const needle = `/${itemId}`;
|
||||||
|
for (const key of itemCacheMap.keys()) {
|
||||||
|
if (key.includes(needle)) {
|
||||||
|
itemCacheMap.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
// Continued...
|
// Continued...
|
||||||
|
|
||||||
const sbtForm = document.getElementById('sbtForm');
|
const sbtForm = document.getElementById('sbtForm');
|
||||||
|
|||||||
@@ -120,7 +120,13 @@
|
|||||||
postid,
|
postid,
|
||||||
existingTags: tags,
|
existingTags: tags,
|
||||||
anchorEl: anchor,
|
anchorEl: anchor,
|
||||||
onSubmit: async (tag) => post("/api/v2/tags/" + postid, { tagname: tag }),
|
onSubmit: async (tag) => {
|
||||||
|
const res = await post("/api/v2/tags/" + postid, { tagname: tag });
|
||||||
|
if (res.success && window.invalidateItemCache) {
|
||||||
|
window.invalidateItemCache(postid);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
renderTags
|
renderTags
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user