Merge remote-tracking branch 'origin/main' into feat/support-agent-sandbox

This commit is contained in:
yyh
2026-01-21 13:21:39 +08:00
38 changed files with 331 additions and 314 deletions

View File

@ -1,4 +1,3 @@
import type { UnsafeUnwrappedHeaders } from 'next/headers'
import type { FC } from 'react'
import { headers } from 'next/headers'
import Script from 'next/script'
@ -26,14 +25,14 @@ const extractNonceFromCSP = (cspHeader: string | null): string | undefined => {
return nonceMatch ? nonceMatch[1] : undefined
}
const GA: FC<IGAProps> = ({
const GA: FC<IGAProps> = async ({
gaType,
}) => {
if (IS_CE_EDITION)
return null
const cspHeader = IS_PROD
? (headers() as unknown as UnsafeUnwrappedHeaders).get('content-security-policy')
? (await headers()).get('content-security-policy')
: null
const nonce = extractNonceFromCSP(cspHeader)

View File

@ -2089,7 +2089,7 @@ describe('Integration: Hit Testing Flow', () => {
isLoading: false,
} as unknown as ReturnType<typeof useDatasetTestingRecords>)
renderWithProviders(<HitTestingPage datasetId="dataset-1" />)
const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)
// Type query
const textarea = screen.getByRole('textbox')
@ -2101,11 +2101,8 @@ describe('Integration: Hit Testing Flow', () => {
if (submitButton)
fireEvent.click(submitButton)
// Wait for the component to update
await waitFor(() => {
// Verify the component is still rendered
expect(screen.getByRole('textbox')).toBeInTheDocument()
})
// Verify the component is still rendered after submission
expect(container.firstChild).toBeInTheDocument()
})
it('should render ResultItem components for non-external results', async () => {
@ -2130,7 +2127,7 @@ describe('Integration: Hit Testing Flow', () => {
isLoading: false,
} as unknown as ReturnType<typeof useDatasetTestingRecords>)
renderWithProviders(<HitTestingPage datasetId="dataset-1" />)
const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)
// Submit a query
const textarea = screen.getByRole('textbox')
@ -2141,10 +2138,8 @@ describe('Integration: Hit Testing Flow', () => {
if (submitButton)
fireEvent.click(submitButton)
await waitFor(() => {
// Verify component is rendered
expect(screen.getByRole('textbox')).toBeInTheDocument()
})
// Verify component is rendered after submission
expect(container.firstChild).toBeInTheDocument()
})
it('should render external results when dataset is external', async () => {