@@ -47,6 +47,9 @@ import type { LaidOutNode, LayoutGroup } from './layout'
4747
4848interface Props {
4949 file : FeaturesFile
50+ /** 上层传入的项目 id(用于 bundled 项目识别 + localStorage 分桶)。
51+ * 没有时退化为 file.manifest.repo。 */
52+ activeRepoId ?: string | null
5053}
5154
5255const nodeTypes = {
@@ -64,11 +67,11 @@ function viewKeyOf(state: FcgViewState): string {
6467 : state . mode
6568}
6669
67- export function GraphCanvas ( { file } : Props ) {
68- return < GraphInner file = { file } />
70+ export function GraphCanvas ( { file, activeRepoId } : Props ) {
71+ return < GraphInner file = { file } activeRepoId = { activeRepoId } />
6972}
7073
71- function GraphInner ( { file } : Props ) {
74+ function GraphInner ( { file, activeRepoId } : Props ) {
7275 const [ state , setState ] = useState < FcgViewState > ( { mode : 'overview' } )
7376 const [ selectedId , setSelectedId ] = useState < string | null > ( null )
7477 /** hover 节点 id:用于实时降噪——hover 时其他节点和边淡出,相关边加亮 */
@@ -78,10 +81,10 @@ function GraphInner({ file }: Props) {
7881 const view = useMemo ( ( ) => buildView ( file , state ) , [ file , state ] )
7982 const viewKey = viewKeyOf ( state )
8083
81- // 项目标识:用于 localStorage 分桶
84+ // 项目标识:上层传入优先(bundled 项目用 bundled:slug 作识别),回退到 manifest.repo
8285 const repoId = useMemo (
83- ( ) => file . manifest . repo ?? 'default' ,
84- [ file . manifest . repo ] ,
86+ ( ) => activeRepoId ?? file . manifest . repo ?? 'default' ,
87+ [ activeRepoId , file . manifest . repo ] ,
8588 )
8689
8790 // 节点位置缓存(按 viewKey 分桶):启动时从 localStorage 加载(草稿)
0 commit comments