Skip to content

Commit d1dcdf8

Browse files
committed
fix: save doclink after re-direction in iframe
1 parent 6defb79 commit d1dcdf8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/components/app/details/main.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ const AIAgentContextSetterWrapper = ({ children, appName }: PropsWithChildren<{
6565
const { path, url } = useRouteMatch()
6666

6767
useEffect(() => {
68-
setAIAgentContext({ path, context: { appName, ...params }})
68+
const contextData: Record<string, string> = {
69+
...params,
70+
}
71+
if (contextData.buildId) {
72+
// For build history page
73+
contextData['Workflow_id'] = contextData.buildId
74+
delete contextData.buildId
75+
}
76+
setAIAgentContext({ path, context: { appName, ...contextData }})
6977
}, [path, url])
7078

7179
return <>{children}</>

src/components/common/SidePanel/SidePanelDocumentation.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ export const SidePanelDocumentation = ({ SidePanelHeaderActions }: SidePanelCont
4444
iframeKeyRef.current = `${docLink}-${getUniqueId()}`
4545
setSidePanelConfig((prev) => ({ ...prev, reinitialize: false }))
4646
}
47+
48+
let iframeLatestSrc = docLink
49+
50+
const interval = setInterval(() => {
51+
if (iframeRef.current?.contentWindow?.location?.href) {
52+
iframeLatestSrc = iframeRef.current.contentWindow.location.href
53+
}
54+
}, 100)
55+
56+
return () => {
57+
clearInterval(interval)
58+
setSidePanelConfig((prev) => ({ ...prev, reinitialize: false, docLink: iframeLatestSrc }))
59+
}
4760
}, [reinitialize])
4861

4962
return (

0 commit comments

Comments
 (0)