mirror of
https://github.com/langgenius/dify.git
synced 2026-08-30 17:11:50 +08:00
chore(deps): upgrade pnpm workspace dependencies (#41138)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getEnvironmentTabLayout } from '../layout'
|
||||
import { getEnvironmentTabLayout } from '../layout-calculations'
|
||||
|
||||
const environmentTabWidths = {
|
||||
canary: 72,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
|
||||
import { ENVIRONMENT_TAB_LABEL_MAX_WIDTH } from './layout'
|
||||
import { ENVIRONMENT_TAB_LABEL_MAX_WIDTH } from './layout-calculations'
|
||||
|
||||
export function EnvironmentButton({
|
||||
active,
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
estimateFallbackTextWidth,
|
||||
getEnvironmentTabLayout,
|
||||
SELECTED_OVERFLOW_LABEL_MAX_WIDTH,
|
||||
} from './layout'
|
||||
} from './layout-calculations'
|
||||
import { EnvironmentTabsMeasurementProbe } from './measurement-probe'
|
||||
import { useEnvironmentTabMeasurements } from './use-measurements'
|
||||
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ export const ENVIRONMENT_TAB_HORIZONTAL_PADDING = 16
|
||||
export const ENVIRONMENT_TAB_LABEL_MAX_WIDTH =
|
||||
ENVIRONMENT_TAB_MAX_WIDTH - ENVIRONMENT_TAB_HORIZONTAL_PADDING
|
||||
export const SELECTED_OVERFLOW_LABEL_MAX_WIDTH = ENVIRONMENT_TAB_LABEL_MAX_WIDTH - 16
|
||||
export const TAB_GAP = 4
|
||||
const TAB_GAP = 4
|
||||
|
||||
type EnvironmentTabLayout = {
|
||||
overflowEnvironmentIds: string[]
|
||||
@@ -40,7 +40,7 @@ export function estimateFallbackTabWidth(value: string) {
|
||||
)
|
||||
}
|
||||
|
||||
function rowWidth(widths: readonly number[]) {
|
||||
function getRowWidth(widths: readonly number[]) {
|
||||
if (widths.length === 0) return 0
|
||||
return widths.reduce((total, width) => total + width, 0) + (widths.length - 1) * TAB_GAP
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export function getEnvironmentTabLayout({
|
||||
(environmentId) => environmentTabWidths[environmentId] ?? ENVIRONMENT_TAB_MAX_WIDTH,
|
||||
)
|
||||
const allTabsFit =
|
||||
!hasUndeployedEnvironments && rowWidth([builtInWidth, ...joinedWidths]) <= availableWidth
|
||||
!hasUndeployedEnvironments && getRowWidth([builtInWidth, ...joinedWidths]) <= availableWidth
|
||||
|
||||
if (allTabsFit) {
|
||||
return {
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
ENVIRONMENT_TAB_MAX_WIDTH,
|
||||
estimateFallbackTabWidth,
|
||||
estimateFallbackTextWidth,
|
||||
} from './layout'
|
||||
} from './layout-calculations'
|
||||
|
||||
export function useEnvironmentTabMeasurements({
|
||||
builtInLabel,
|
||||
|
||||
@@ -210,16 +210,11 @@ describe('image-uploader store', () => {
|
||||
describe('useFileStoreWithSelector', () => {
|
||||
it('should throw error when used outside provider', () => {
|
||||
const TestComponent = () => {
|
||||
try {
|
||||
useFileStoreWithSelector((state) => state.files)
|
||||
return <div>No Error</div>
|
||||
} catch {
|
||||
return <div>Error</div>
|
||||
}
|
||||
useFileStoreWithSelector((state) => state.files)
|
||||
return null
|
||||
}
|
||||
|
||||
render(<TestComponent />)
|
||||
expect(screen.getByText('Error')).toBeInTheDocument()
|
||||
expect(() => render(<TestComponent />)).toThrow('Missing FileContext.Provider in the tree')
|
||||
})
|
||||
|
||||
it('should select files from store', () => {
|
||||
|
||||
+7
-4
@@ -110,10 +110,13 @@ const makeProviderSummary = (): ModelProviderSummaryResponse => ({
|
||||
|
||||
const renderWithQueryClient = (node: ReactNode) => {
|
||||
const queryClient = createConsoleQueryClient()
|
||||
queryClient.setQueryData(consoleQuery.workspaces.current.modelProviders.summary.get.key(), {
|
||||
data: [makeProviderSummary()],
|
||||
plugins: {},
|
||||
})
|
||||
queryClient.setQueryData(
|
||||
consoleQuery.workspaces.current.modelProviders.summary.get.queryOptions().queryKey,
|
||||
{
|
||||
data: [makeProviderSummary()],
|
||||
plugins: {},
|
||||
},
|
||||
)
|
||||
return render(<QueryClientProvider client={queryClient}>{node}</QueryClientProvider>)
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -128,11 +128,13 @@ const ModelLoadBalancingConfigs = ({
|
||||
|
||||
const clearCountdown = useCallback(
|
||||
(index: number) => {
|
||||
updateConfigEntry(index, ({ ttl: _, ...entry }) => {
|
||||
return {
|
||||
updateConfigEntry(index, (entry) => {
|
||||
const updatedEntry = {
|
||||
...entry,
|
||||
in_cooldown: false,
|
||||
}
|
||||
delete updatedEntry.ttl
|
||||
return updatedEntry
|
||||
})
|
||||
},
|
||||
[updateConfigEntry],
|
||||
|
||||
@@ -283,7 +283,7 @@ export const Workflow: FC<WorkflowProps> = memo(
|
||||
}, [edges, nodes, setEdges, setNodes, store])
|
||||
|
||||
useEffect(() => {
|
||||
return collaborationManager.onHistoryAction((_) => {
|
||||
return collaborationManager.onHistoryAction(() => {
|
||||
toast.info(t(($) => $['collaboration.historyAction.generic'], { ns: 'workflow' }))
|
||||
})
|
||||
}, [t])
|
||||
|
||||
@@ -95,7 +95,7 @@ export const buildUsedOutVars = ({
|
||||
return {
|
||||
label: {
|
||||
nodeType: varInfo?.data.type,
|
||||
nodeName: varInfo?.data.title || canChooseVarNodes[0]?.data.title!,
|
||||
nodeName: varInfo?.data.title || canChooseVarNodes[0]?.data.title || '',
|
||||
variable: isSystemVar(valueSelector)
|
||||
? valueSelector.join('.')
|
||||
: valueSelector[valueSelector.length - 1]!,
|
||||
|
||||
@@ -277,7 +277,7 @@ export function translate(selector: SelectorParam<'app'>, key: string, kind: key
|
||||
|
||||
it('should adapt local react-i18next translation mocks', () => {
|
||||
// Arrange
|
||||
const source = `import { vi } from 'vitest'
|
||||
const source = `import { vi } from 'vite-plus/test'
|
||||
|
||||
vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({
|
||||
@@ -295,7 +295,7 @@ const businessProps = {
|
||||
const result = transformSource(source, 'example.spec.ts')
|
||||
|
||||
// Assert
|
||||
expect(result.output).toBe(`import { vi } from 'vitest'
|
||||
expect(result.output).toBe(`import { vi } from 'vite-plus/test'
|
||||
|
||||
vi.mock('react-i18next', async () => {
|
||||
const { withSelectorKey, withSelectorKeyProps } = await import('@/test/i18n-mock')
|
||||
@@ -320,7 +320,7 @@ const businessProps = {
|
||||
|
||||
it('should adapt selector mocks from the local i18n facade', () => {
|
||||
// Arrange
|
||||
const source = `import { vi } from 'vitest'
|
||||
const source = `import { vi } from 'vite-plus/test'
|
||||
|
||||
vi.mock('#i18n', () => ({
|
||||
useTranslation: () => ({
|
||||
@@ -346,7 +346,7 @@ vi.mock('#i18n', () => ({
|
||||
|
||||
it('should defer mock callbacks declared outside a hoisted factory', () => {
|
||||
// Arrange
|
||||
const source = `import { vi } from 'vitest'
|
||||
const source = `import { vi } from 'vite-plus/test'
|
||||
|
||||
const mockTranslation = (key: string) => key
|
||||
|
||||
@@ -373,7 +373,7 @@ vi.mock('#i18n', () => ({
|
||||
it('should preserve selector-aware i18next mock adapters', () => {
|
||||
// Arrange
|
||||
const source = `import type { Namespace, SelectorParam } from 'i18next'
|
||||
import { vi } from 'vitest'
|
||||
import { vi } from 'vite-plus/test'
|
||||
|
||||
vi.mock('i18next', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('i18next')>()
|
||||
@@ -394,7 +394,7 @@ vi.mock('i18next', async (importOriginal) => {
|
||||
it('should transform a multiline JSX Trans mock without overlapping edits', () => {
|
||||
// Arrange
|
||||
const source = `import type { ReactNode } from 'react'
|
||||
import { vi } from 'vitest'
|
||||
import { vi } from 'vite-plus/test'
|
||||
|
||||
vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({
|
||||
@@ -443,7 +443,7 @@ vi.mock('react-i18next', () => ({
|
||||
|
||||
it('should adapt only translation values configured through a referenced hoisted mock', () => {
|
||||
// Arrange
|
||||
const source = `import { vi } from 'vitest'
|
||||
const source = `import { vi } from 'vite-plus/test'
|
||||
|
||||
const mockUseTranslation = vi.hoisted(() => vi.fn())
|
||||
const reactI18nextMock = {
|
||||
@@ -465,7 +465,7 @@ const businessProps = {
|
||||
const result = transformSource(source, 'example.spec.ts')
|
||||
|
||||
// Assert
|
||||
expect(result.output).toBe(`import { vi } from 'vitest'
|
||||
expect(result.output).toBe(`import { vi } from 'vite-plus/test'
|
||||
import { withSelectorKey } from '@/test/i18n-mock'
|
||||
|
||||
const mockUseTranslation = vi.hoisted(() => vi.fn())
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
"~@/*": ["./*"]
|
||||
},
|
||||
"resolveJsonModule": true,
|
||||
"types": ["vitest/globals", "node"],
|
||||
"types": ["vite-plus/test/globals", "node"],
|
||||
"allowImportingTsExtensions": true,
|
||||
"allowJs": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user