An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Avoid duplicate marketplace refresh requests https://github.com/siyuan-note/siyuan/issues/18611
Daniel48142676ef8d
diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.tsindex 96eba1c427..a69b83c729 100644--- a/app/src/config/bazaar.ts+++ b/app/src/config/bazaar.ts@@ -616,7 +616,7 @@ ${primaryAction ? '<div class="fn__hr"></div>' : ""}const typeBtn = contentElement.previousElementSibling.querySelector(`[data-type="${myType}"]`) as HTMLElement;if (contentElement.getAttribute("data-loading") === "true" ||typeBtn?.classList.contains("b3-button--outline")) {- return;+ return false;}bazaar._updateDownloadedToolbar(bazaarType);contentElement.setAttribute("data-loading", "true");@@ -629,7 +629,7 @@ ${primaryAction ? '<div class="fn__hr"></div>' : ""}};if (!(bazaarType in installedAPI)) {contentElement.removeAttribute("data-loading");- return;+ return false;}bazaar._updateDownloadedSortSelect(bazaarType);const initialSortValue = bazaar._getDownloadedSortValue(bazaarType);@@ -711,14 +711,18 @@ type="checkbox">if (sideElement?.getAttribute("data-from") === "downloaded" &&sideElement.getAttribute("data-package-type") === bazaarType) {const packageName = sideElement.getAttribute("data-name");- bazaar._data.downloaded.find((i) => {- if (i.name === packageName) {- bazaar._renderReadme(bazaarType, "downloaded", i);- return true;- }- });+ const downloadedItem = bazaar._data.downloaded.find((item) => item.name === packageName);+ if (downloadedItem) {+ const detail = bazaar._getPackageDetail(bazaarType, packageName);+ bazaar._setPackageDetail(bazaarType, packageName, {+ ...detail,+ installed: downloadedItem,+ });+ bazaar._refreshReadmeDetail(bazaarType, packageName);+ }}});+ return true;},_data: {themes: [] as IBazaarItem[],@@ -905,7 +909,8 @@ type="checkbox">highlightRender(mdElement);});}- if (installed) {+ const needsPackageDetail = !detail && (from === "downloaded" || (from === "bazaar" && data.installed));+ if (installed && !needsPackageDetail) {fetchPost("/api/bazaar/getInstalledPackageSize", {packageType: bazaarType,packageName: installed.name,@@ -922,7 +927,7 @@ type="checkbox">});}readmeElement.classList.add("config__view--show");- if (!detail && (from === "downloaded" || (from === "bazaar" && data.installed))) {+ if (needsPackageDetail) {bazaar._fetchPackageDetail(bazaarType, data.name, (packageDetail) => {const sideElement = readmeElement.querySelector(".item__side");if (sideElement?.getAttribute("data-from") !== from ||@@ -1091,10 +1096,16 @@ type="checkbox">});},_refreshPackageUI(bazaarType: TBazaarType, packageName: string, app: App) {- bazaar._genMyHTML(bazaarType, app);- bazaar._reloadBazaarType(bazaarType);- bazaar._checkUpdate(true);- bazaar._refreshReadmeDetail(bazaarType, packageName);+ const sideElement = bazaar.element.querySelector("#configBazaarReadme.config__view--show .item__side");+ const refreshFromDownloadedList = sideElement?.getAttribute("data-from") === "downloaded" &&+ sideElement.getAttribute("data-package-type") === bazaarType;+ const refreshDownloadedList = bazaar._genMyHTML(bazaarType, app);+ if (bazaarType !== "plugins") {+ bazaar._reloadBazaarType(bazaarType);+ }+ if (!refreshFromDownloadedList || !refreshDownloadedList) {+ bazaar._refreshReadmeDetail(bazaarType, packageName);+ }},_setPluginEnabled(app: App, item: IBazaarItem, enabled: boolean, callback: () => void) {fetchPost("/api/petal/setPetalEnabled", {@@ -1704,7 +1715,6 @@ type="checkbox">bazaar._setPluginEnabled(app, pluginItem, enabled, () => {target.removeAttribute("disabled");this._genMyHTML("plugins", app, true);- bazaar._refreshReadmeDetail("plugins", pluginItem.name);});}event.stopPropagation();