An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: The backlink panel no longer displays child-block references https://github.com/siyuan-note/siyuan/issues/12861
Daniele2b2d46a47a3
diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.tsindex dd7cff1668..9590fccf1a 100644--- a/app/src/layout/dock/Backlink.ts+++ b/app/src/layout/dock/Backlink.ts@@ -437,7 +437,7 @@ export class Backlink extends Model {defID: this.blockId,refTreeID: docId,keyword: isMention ? this.inputsElement[1].value : this.inputsElement[0].value,- containChildren: true+ containChildren: false}, (response) => {svgElement.removeAttribute("disabled");svgElement.classList.add("b3-list-item__arrow--open");diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.tsindex 98da788a50..47b699a610 100644--- a/app/src/protyle/util/reload.ts+++ b/app/src/protyle/util/reload.ts@@ -44,7 +44,7 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?defID: protyle.element.getAttribute("data-defid"),refTreeID: protyle.block.rootID,keyword: isMention ? inputsElement[1].value : inputsElement[0].value,- containChildren: true+ containChildren: false}, response => {protyle.options.backlinkData = isMention ? response.data.backmentions : response.data.backlinks;renderBacklink(protyle, protyle.options.backlinkData);diff --git a/kernel/model/backlink.go b/kernel/model/backlink.goindex e5b1af356f..ec81e89517 100644--- a/kernel/model/backlink.go+++ b/kernel/model/backlink.go@@ -240,7 +240,7 @@ func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortModerootID := sqlBlock.RootIDboxID = sqlBlock.Box- refs := sql.QueryRefsByDefID(id, true)+ refs := sql.QueryRefsByDefID(id, false)refs = removeDuplicatedRefs(refs)linkRefs, linkRefsCount, excludeBacklinkIDs := buildLinkRefs(rootID, refs, keyword)@@ -339,7 +339,7 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int) (boxID strinboxID = sqlBlock.Boxvar links []*Block- refs := sql.QueryRefsByDefID(id, true)+ refs := sql.QueryRefsByDefID(id, false)refs = removeDuplicatedRefs(refs)// 为了减少查询,组装好 IDs 后一次查出diff --git a/kernel/sql/block_ref_query.go b/kernel/sql/block_ref_query.goindex 91777fdd3f..a5272f5c0b 100644--- a/kernel/sql/block_ref_query.go+++ b/kernel/sql/block_ref_query.go@@ -389,26 +389,17 @@ func QueryRefsRecent(onlyDoc bool, typeFilter string, ignoreLines []string) (ret}func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {- sqlBlock := GetBlock(defBlockID)- if nil == sqlBlock {- return- }-var rows *sql.Rowsvar err error- if "d" == sqlBlock.Type {- rows, err = query("SELECT * FROM refs WHERE def_block_root_id = ?", defBlockID)- } else {- if containChildren {- blockIDs := queryBlockChildrenIDs(defBlockID)- var params []string- for _, id := range blockIDs {- params = append(params, "\""+id+"\"")- }- rows, err = query("SELECT * FROM refs WHERE def_block_id IN (" + strings.Join(params, ",") + ")")- } else {- rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)+ if containChildren {+ blockIDs := queryBlockChildrenIDs(defBlockID)+ var params []string+ for _, id := range blockIDs {+ params = append(params, "\""+id+"\"")}+ rows, err = query("SELECT * FROM refs WHERE def_block_id IN (" + strings.Join(params, ",") + ")")+ } else {+ rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)}if err != nil {logging.LogErrorf("sql query failed: %s", err)