Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore(deps): upgrade Base UI to 1.7.0 (#40006)

yyh2fd8f98f2d3a
diff --git a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
index bb090065ff2..fb783cbb346 100644
--- a/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/autocomplete/__tests__/index.spec.tsx
@@ -87,9 +87,6 @@ describe('Autocomplete wrappers', () => {
await expect
.element(screen.getByRole('combobox', { name: 'Search suggestions' }))
.toHaveAttribute('autocomplete', 'off')
- await expect
- .element(screen.getByRole('combobox', { name: 'Search suggestions' }))
- .toHaveAttribute('type', 'text')
await expect
.element(screen.getByRole('combobox', { name: 'Search suggestions' }))
.toHaveAttribute('placeholder', 'Find a resource')
@@ -100,6 +97,18 @@ describe('Autocomplete wrappers', () => {
.element(screen.getByRole('combobox', { name: 'Search suggestions' }))
.toHaveClass('custom-input')
})
+
+ it('should not inject input-only attributes into a custom textarea', async () => {
+ const screen = await renderAutocomplete({
+ children: (
+ <AutocompleteInputGroup>
+ <AutocompleteInput aria-label="Search suggestions" render={<textarea />} />
+ </AutocompleteInputGroup>
+ ),
+ })
+
+ await expect.element(screen.getByLabelText('Search suggestions')).not.toHaveAttribute('type')
+ })
})
describe('Controls', () => {
diff --git a/packages/dify-ui/src/autocomplete/index.tsx b/packages/dify-ui/src/autocomplete/index.tsx
index 6b95184f8b5..2ef70c955f6 100644
--- a/packages/dify-ui/src/autocomplete/index.tsx
+++ b/packages/dify-ui/src/autocomplete/index.tsx
@@ -147,13 +147,11 @@ type AutocompleteInputProps = Omit<BaseAutocomplete.Input.Props, 'className' | '
function AutocompleteInput({
className,
size = 'medium',
- type = 'text',
autoComplete = 'off',
...props
}: AutocompleteInputProps) {
return (
<BaseAutocomplete.Input
- type={type}
autoComplete={autoComplete}
className={cn(autocompleteInputVariants({ size }), className)}
{...props}
diff --git a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx b/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
index 984b53085b8..428ce43229d 100644
--- a/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/combobox/__tests__/index.spec.tsx
@@ -130,9 +130,6 @@ describe('Combobox wrappers', () => {
await expect
.element(screen.getByRole('combobox', { name: 'Search resources' }))
.toHaveAttribute('autocomplete', 'off')
- await expect
- .element(screen.getByRole('combobox', { name: 'Search resources' }))
- .toHaveAttribute('type', 'text')
await expect
.element(screen.getByRole('combobox', { name: 'Search resources' }))
.toHaveAttribute('placeholder', 'Find a resource')
@@ -144,6 +141,18 @@ describe('Combobox wrappers', () => {
.toHaveClass('custom-input')
})
+ it('should not inject input-only attributes into a custom textarea', async () => {
+ const screen = await renderInputCombobox({
+ children: (
+ <ComboboxInputGroup>
+ <ComboboxInput aria-label="Search resources" render={<textarea />} />
+ </ComboboxInputGroup>
+ ),
+ })
+
+ await expect.element(screen.getByLabelText('Search resources')).not.toHaveAttribute('type')
+ })
+
it('should provide fallback aria labels and decorative icons for input controls', async () => {
const screen = await renderInputCombobox()
diff --git a/packages/dify-ui/src/combobox/index.tsx b/packages/dify-ui/src/combobox/index.tsx
index 64ea7470717..af4dc77ebcf 100644
--- a/packages/dify-ui/src/combobox/index.tsx
+++ b/packages/dify-ui/src/combobox/index.tsx
@@ -207,13 +207,11 @@ type ComboboxInputProps = Omit<BaseCombobox.Input.Props, 'className' | 'size'> &
function ComboboxInput({
className,
size = 'medium',
- type = 'text',
autoComplete = 'off',
...props
}: ComboboxInputProps) {
return (
<BaseCombobox.Input
- type={type}
autoComplete={autoComplete}
className={cn(comboboxInputVariants({ size }), className)}
{...props}
diff --git a/packages/dify-ui/vite.config.ts b/packages/dify-ui/vite.config.ts
index d814d8b96d3..b5e82761bd3 100644
--- a/packages/dify-ui/vite.config.ts
+++ b/packages/dify-ui/vite.config.ts
@@ -6,7 +6,4 @@ export default defineConfig({
resolve: {
tsconfigPaths: true,
},
- optimizeDeps: {
- include: ['@base-ui/react/form', '@base-ui/react/merge-props', '@base-ui/react/use-render'],
- },
})
diff --git a/packages/dify-ui/vitest.config.ts b/packages/dify-ui/vitest.config.ts
index 27d4b612875..214c8759432 100644
--- a/packages/dify-ui/vitest.config.ts
+++ b/packages/dify-ui/vitest.config.ts
@@ -16,12 +16,7 @@ export default defineConfig({
tsconfigPaths: true,
},
optimizeDeps: {
- include: [
- '@base-ui/react/form',
- '@base-ui/react/merge-props',
- '@base-ui/react/use-render',
- 'vite-plus/test/browser',
- ],
+ include: ['vite-plus/test/browser'],
},
test: {
coverage: {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 06d4e16e060..a0819f87f75 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,8 +13,8 @@ catalogs:
specifier: 1.33.6
version: 1.33.6
'@base-ui/react':
- specifier: 1.6.0
- version: 1.6.0
+ specifier: 1.7.0
+ version: 1.7.0
'@chromatic-com/storybook':
specifier: 5.2.1
version: 5.2.1
@@ -974,7 +974,7 @@ importers:
devDependencies:
'@base-ui/react':
specifier: 'catalog:'
'@chromatic-com/storybook':
specifier: 'catalog:'
@@ -1166,7 +1166,7 @@ importers:
version: 1.33.6(@amplitude/[email protected])
'@base-ui/react':
specifier: 'catalog:'
'@emoji-mart/data':
specifier: 'catalog:'
version: 1.2.1
@@ -1823,8 +1823,8 @@ packages:
resolution: {integrity: sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==}
engines: {node: '>=6.9.0'}
- '@base-ui/[email protected]':
- resolution: {integrity: sha512-/jzjTWJYXhRFO45Bev9lc3cHbmjzCMpUqbMZ2AgKy/z25mY9B6shGSNcXcjQar9n5doM0KYW1W8fcFv2jZBuMw==}
+ '@base-ui/[email protected]':
+ resolution: {integrity: sha512-j+8QjX44C32jrXD/qyEAGpFr70FRpGL2CY61mQd9nBPWN737CK0xxD1ceJ055rW4RtdvFDT1e7otzdlfxvsYug==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@date-fns/tz': ^1.2.0
@@ -1840,8 +1840,8 @@ packages:
date-fns:
optional: true
- '@base-ui/[email protected]':
- resolution: {integrity: sha512-gFFiltORVmW/N6IILTGxizP3PBpVpysqML1ALY5Vk0mH+7faVkCknOU31goYHN5Aoek2dkjxva1XOD2Ce9WuIg==}
+ '@base-ui/[email protected]':
+ resolution: {integrity: sha512-oWy1aq/I2GmYjpl4PhEAhzflF8VPGKgZeq0xAWTbfD5KBWyxcN0ZP2+WHSUm/5Z6lVMBDLReLcoXwSYoRc/zNQ==}
peerDependencies:
'@types/react': ^17 || ^18 || ^19
react: ^17 || ^18 || ^19
@@ -9434,10 +9434,10 @@ snapshots:
'@babel/helper-string-parser': 7.29.7
'@babel/helper-validator-identifier': 7.29.7
dependencies:
'@babel/runtime': 7.29.7
'@floating-ui/react-dom': 2.1.9([email protected]([email protected]))([email protected])
'@floating-ui/utils': 0.2.12
react: 19.2.8
@@ -9446,7 +9446,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.17
dependencies:
'@babel/runtime': 7.29.7
'@floating-ui/utils': 0.2.12
@@ -17614,7 +17614,7 @@ snapshots:
time:
'@amplitude/[email protected]': '2026-07-22T02:02:03.450Z'
'@amplitude/[email protected]': '2026-07-22T02:02:48.133Z'
- '@base-ui/[email protected]': '2026-06-18T12:04:15.326Z'
+ '@base-ui/[email protected]': '2026-08-04T09:55:20.089Z'
'@chromatic-com/[email protected]': '2026-05-14T07:49:29.364Z'
'@cucumber/[email protected]': '2026-07-20T07:16:23.549Z'
'@egoist/[email protected]': '2026-01-31T10:48:44.594Z'
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index b74a4cc60ef..99a57af9d8f 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -52,7 +52,7 @@ overrides:
catalog:
'@amplitude/analytics-browser': 2.45.4
'@amplitude/plugin-session-replay-browser': 1.33.6
- '@base-ui/react': 1.6.0
+ '@base-ui/react': 1.7.0
'@chromatic-com/storybook': 5.2.1
'@cucumber/cucumber': 13.2.0
'@egoist/tailwindcss-icons': 1.9.2
diff --git a/web/app/components/app/log/__tests__/index.spec.tsx b/web/app/components/app/log/__tests__/index.spec.tsx
index cd7bffd2a74..3bdb621fdbe 100644
--- a/web/app/components/app/log/__tests__/index.spec.tsx
+++ b/web/app/components/app/log/__tests__/index.spec.tsx
@@ -17,24 +17,11 @@ const mockUseCompletionConversations = vi.fn()
const mockPlanState = vi.hoisted(() => ({
value: 'unrestricted' as CloudSandboxPlanState,
}))
-const mockDebouncedPeriod = vi.hoisted(() => ({
- value: null as string | null,
-}))
let mockSearchParams = new URLSearchParams()
vi.mock('ahooks', async () => {
return {
- useDebounce: <T,>(value: T) => {
- if (
- mockDebouncedPeriod.value === null ||
- typeof value !== 'object' ||
- value === null ||
- !('period' in value)
- )
- return value
-
- return { ...value, period: mockDebouncedPeriod.value }
- },
+ useDebounce: <T,>(value: T) => value,
}
})
@@ -92,7 +79,6 @@ describe('Logs', () => {
vi.clearAllMocks()
mockSearchParams = new URLSearchParams()
mockPlanState.value = 'unrestricted'
- mockDebouncedPeriod.value = null
mockUseChatConversations.mockReturnValue({
data: undefined,
refetch: vi.fn(),
@@ -211,7 +197,7 @@ describe('Logs', () => {
)
})
- it('should use a valid period for the real Chip and request when a cached period settles to Sandbox', async () => {
+ it('should use today when a cached period is unavailable to a Sandbox workspace', async () => {
const user = userEvent.setup()
const appDetail = {
id: 'app-period-transition',
@@ -236,9 +222,8 @@ describe('Logs', () => {
)
unrestrictedRender.unmount()
- mockPlanState.value = 'pending'
- mockDebouncedPeriod.value = '9'
- const pendingRender = render(<Logs appDetail={appDetail} />)
+ mockPlanState.value = 'sandbox'
+ render(<Logs appDetail={appDetail} />)
expect(
screen.getByRole('combobox', { name: /appLog\.filter\.period\.today/ }),
@@ -256,20 +241,5 @@ describe('Logs', () => {
}),
}),
)
-
- mockPlanState.value = 'sandbox'
- pendingRender.rerender(<Logs appDetail={appDetail} />)
-
- expect(
- screen.getByRole('combobox', { name: /appLog\.filter\.period\.today/ }),
- ).toBeInTheDocument()
- expect(mockUseChatConversations.mock.calls.at(-1)?.[0]).toEqual(
- expect.objectContaining({
- params: expect.objectContaining({
- start: dayjs().startOf('day').format('YYYY-MM-DD HH:mm'),
- end: expect.any(String),
- }),
- }),
- )
})
})
diff --git a/web/app/components/app/workflow-log/__tests__/index.spec.tsx b/web/app/components/app/workflow-log/__tests__/index.spec.tsx
index 8068fbe42f0..7d94eb713ca 100644
--- a/web/app/components/app/workflow-log/__tests__/index.spec.tsx
+++ b/web/app/components/app/workflow-log/__tests__/index.spec.tsx
@@ -38,9 +38,6 @@ import Logs from '../index'
const mockPlanState = vi.hoisted(() => ({
value: 'unrestricted' as CloudSandboxPlanState,
}))
-const mockDebouncedPeriod = vi.hoisted(() => ({
- value: null as string | null,
-}))
vi.mock('@/service/use-log')
@@ -53,17 +50,7 @@ vi.mock('../../log/cloud-sandbox-retention', async (importOriginal) => {
})
vi.mock('ahooks', () => ({
- useDebounce: <T,>(value: T) => {
- if (
- mockDebouncedPeriod.value === null ||
- typeof value !== 'object' ||
- value === null ||
- !('period' in value)
- )
- return value
-
- return { ...value, period: mockDebouncedPeriod.value }
- },
+ useDebounce: <T,>(value: T) => value,
useDebounceFn: (fn: (value: string) => void) => ({ run: fn }),
useBoolean: (initial: boolean) => {
const setters = {
@@ -279,7 +266,6 @@ describe('Logs Container', () => {
beforeEach(() => {
vi.clearAllMocks()
mockPlanState.value = 'unrestricted'
- mockDebouncedPeriod.value = null
})
// --------------------------------------------------------------------------
@@ -511,53 +497,6 @@ describe('Logs Container', () => {
).toBe(30)
})
- it('should use a valid period for the real Chip and request when plan state settles to Sandbox', async () => {
- const user = userEvent.setup()
- mockedUseWorkflowLogs.mockReturnValue(
- createMockQueryResult<WorkflowLogsResponse>({
- data: createMockLogsResponse([], 0),
- }),
- )
- const rendered = renderWithQueryClient(<Logs {...defaultProps} />)
-
- await user.click(screen.getByText('appLog.filter.period.last7days'))
- await user.click(await screen.findByText('appLog.filter.period.allTime'))
- expect(getMockCallParams()?.params).not.toHaveProperty('created_at__after')
- expect(getMockCallParams()?.params).not.toHaveProperty('created_at__before')
-
- mockPlanState.value = 'pending'
- mockDebouncedPeriod.value = '9'
- rendered.rerender(<Logs {...defaultProps} />)
-
- expect(
- screen.getByRole('combobox', { name: 'appLog.filter.period.today' }),
- ).toBeInTheDocument()
- expect(
- screen.getByRole('button', {
- name: /common\.operation\.clear appLog\.filter\.period\.today/,
- }),
- ).toBeInTheDocument()
- expect(getMockCallParams()?.params).toEqual(
- expect.objectContaining({
- created_at__after: expect.any(String),
- created_at__before: expect.any(String),
- }),
- )
-
- mockPlanState.value = 'sandbox'
- rendered.rerender(<Logs {...defaultProps} />)
-
- expect(
- screen.getByRole('combobox', { name: 'appLog.filter.period.today' }),
- ).toBeInTheDocument()
- expect(getMockCallParams()?.params).toEqual(
- expect.objectContaining({
- created_at__after: expect.any(String),
- created_at__before: expect.any(String),
- }),
- )
- })
-
it('should update query when typing keyword', async () => {
// Arrange
const user = userEvent.setup()
diff --git a/web/app/components/base/chip/index.tsx b/web/app/components/base/chip/index.tsx
index a0a709e6f92..f7e089e92cc 100644
--- a/web/app/components/base/chip/index.tsx
+++ b/web/app/components/base/chip/index.tsx
@@ -50,7 +50,7 @@ function Chip<T extends ItemValue>({
: t(($) => $['operation.clear'], { ns: 'common' })
return (
- <Select
+ <Select<T>
value={selectedItem?.value ?? null}
itemToStringLabel={(itemValue: T) =>
items.find((item) => Object.is(item.value, itemValue))?.name ?? ''
@@ -127,7 +127,7 @@ function Chip<T extends ItemValue>({
listClassName="max-h-72 p-1"
>
{items.map((item) => (
- <SelectItem key={item.value} value={item.value}>
+ <SelectItem<T> key={item.value} value={item.value}>
<SelectItemText title={item.name}>{item.name}</SelectItemText>
{showItemIndicator && <SelectItemIndicator />}
</SelectItem>