fix: tree navigation root ID + session closure popover z-index
- TreeNavigationPage: initialize currentNodeId from tree_structure.id instead of hardcoded 'root' — fixes "Invalid tree structure" for trees with non-'root' root IDs (KB Accelerator, AI Flow Builder) - SessionHistoryPage: add relative z-10 to session card when close popover is open so it renders above sibling cards Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,8 +39,8 @@ export function TreeNavigationPage() {
|
||||
|
||||
const [tree, setTree] = useState<Tree | null>(null)
|
||||
const [session, setSession] = useState<Session | null>(null)
|
||||
const [currentNodeId, setCurrentNodeId] = useState<string>('root')
|
||||
const [pathTaken, setPathTaken] = useState<string[]>(['root'])
|
||||
const [currentNodeId, setCurrentNodeId] = useState<string>('')
|
||||
const [pathTaken, setPathTaken] = useState<string[]>([])
|
||||
const [decisions, setDecisions] = useState<DecisionRecord[]>([])
|
||||
const [currentStepEnteredAt, setCurrentStepEnteredAt] = useState<string>(new Date().toISOString())
|
||||
const [notes, setNotes] = useState<string>('')
|
||||
@@ -294,7 +294,7 @@ export function TreeNavigationPage() {
|
||||
const sessionData = await sessionsApi.get(locationState.sessionId)
|
||||
setSession(sessionData)
|
||||
setPathTaken(sessionData.path_taken)
|
||||
setCurrentNodeId(sessionData.path_taken[sessionData.path_taken.length - 1] || 'root')
|
||||
setCurrentNodeId(sessionData.path_taken[sessionData.path_taken.length - 1] || treeData.tree_structure?.id || 'root')
|
||||
setDecisions(sessionData.decisions as DecisionRecord[])
|
||||
setCurrentStepEnteredAt(deriveCurrentStepEnteredAt(sessionData))
|
||||
customStepFlow.initCustomSteps(sessionData.custom_steps || [])
|
||||
@@ -320,6 +320,10 @@ export function TreeNavigationPage() {
|
||||
client_name: clientName || undefined,
|
||||
})
|
||||
setSession(newSession)
|
||||
// Initialize currentNodeId to the tree's actual root (may not be 'root')
|
||||
const rootId = tree.tree_structure?.id || 'root'
|
||||
setCurrentNodeId(rootId)
|
||||
setPathTaken([rootId])
|
||||
setCurrentStepEnteredAt(newSession.started_at || new Date().toISOString())
|
||||
setShowMetadataForm(false)
|
||||
// Save for "Repeat Last Session"
|
||||
|
||||
Reference in New Issue
Block a user