MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / loadWiki

Function loadWiki

deployments/desktop/static/desktop.js:4055–4096  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4053 }
4054
4055 async function loadWiki() {
4056 const stats = await api(`/api/wiki/stats?user_id=${encodeURIComponent(currentUser())}`);
4057 state.wikiStats = stats;
4058 $("wikiNodeStat").textContent = stats.nodes || 0;
4059 $("wikiSettingStat").textContent = stats.nodes || "-";
4060 $("wikiStats").textContent = wikiStatsText(stats);
4061 try {
4062 state.wikiGraph = await api(`/api/wiki/graph?${wikiDailyGraphParams()}`);
4063 } catch (error) {
4064 console.warn("Wiki graph unavailable, falling back to search nodes.", error);
4065 state.wikiGraph = null;
4066 }
4067 state.wikiNodes = state.wikiGraph?.nodes || [];
4068 if (!state.wikiNodes.length && Number(stats.nodes || 0) > 0) {
4069 const fallback = await api(`/api/wiki/search?user_id=${encodeURIComponent(currentUser())}&limit=120`);
4070 state.wikiNodes = fallback.nodes || [];
4071 if (state.wikiNodes.length) {
4072 state.wikiGraph = {
4073 ok: true,
4074 nodes: state.wikiNodes,
4075 edges: state.wikiGraph?.edges || [],
4076 source: "wiki_search_fallback",
4077 query: ""
4078 };
4079 $("wikiStats").textContent = wikiStatsText(stats, ui().wiki.restoredSuffix);
4080 }
4081 }
4082 if (state.wikiView === "graph") {
4083 renderWikiGraph();
4084 setWikiMapFocus(pickWikiFocusNodeId() || "architecture:core");
4085 } else {
4086 const focusId = pickWikiFocusNodeId();
4087 const focusNode = graphNodesById()[focusId];
4088 if (focusNode) {
4089 setWikiEntry(rawGraphTitle(focusNode), rawGraphBody(focusNode), graphId(focusNode));
4090 } else {
4091 setWikiEntry(ui().wiki.architecture, ui().wiki.architectureFallbackBody, "", { renderRelations: false });
4092 renderWikiResultNodes([], ui().wiki.itemCount(0));
4093 }
4094 renderWikiList();
4095 }
4096 }
4097
4098 async function refreshWiki() {
4099 const data = await api("/api/wiki/refresh", {

Callers 10

runDailyFunction · 0.85
pollDailyTaskFunction · 0.85
submitFeedbackFunction · 0.85
directReadFunction · 0.85
refreshWikiFunction · 0.85
syncGithubNotesFunction · 0.85
searchWikiFunction · 0.85
saveSettingsFunction · 0.85
bindEventsFunction · 0.85
initFunction · 0.85

Calls 15

currentUserFunction · 0.85
wikiStatsTextFunction · 0.85
wikiDailyGraphParamsFunction · 0.85
uiFunction · 0.85
renderWikiGraphFunction · 0.85
setWikiMapFocusFunction · 0.85
pickWikiFocusNodeIdFunction · 0.85
graphNodesByIdFunction · 0.85
setWikiEntryFunction · 0.85
rawGraphTitleFunction · 0.85
rawGraphBodyFunction · 0.85
graphIdFunction · 0.85

Tested by

no test coverage detected