[PR #27274] Fix type error #31735

Closed
opened 2026-02-21 20:50:02 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/27274

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

fix #27273

Changes

📦 Dependencies

  • Update Lexical to v0.37.0
    • Unified all lexical and @lexical/* packages to version 0.37.0
    • Added pnpm overrides to prevent version conflicts
    • Fixes type incompatibility between lexical@0.36.2 and lexical@0.37.0

🔧 Type Fixes

Component Refs & Event Handlers

  • Debug Component (debug/index.tsx)

    • Fixed RefObject<DebugWithSingleModelRefType> type mismatch using non-null assertion
  • Create from DSL Modal (create-from-dsl-modal/index.tsx)

    • Updated onCreate function to accept optional MouseEvent parameter
    • Fixed useDebounceFn signature compatibility with keyboard shortcuts

Configuration Components

  • ConfigModal (config-var/config-modal/index.tsx)

    • Ensured default value is properly typed as string for text inputs
  • Prompt Inputs (5 files)

    • Updated onSaveCallback to handle optional ExternalDataTool parameter
    • Affected files:
      • config-prompt/advanced-prompt-input.tsx
      • config-prompt/simple-prompt-input.tsx
      • config-var/index.tsx
      • config/agent/prompt-editor.tsx
      • tools/index.tsx

Annotation Components

  • Removed unused isBatchDeleting state and prop from annotation components
  • Simplified state management in annotation/index.tsx and annotation/list.tsx

🔄 Backward Compatibility

  • Tools AuthType (tools/types.ts)
    • Added AuthType.apiKey = 'api_key' for backend compatibility
    • Backend supports both legacy 'api_key' and current 'api_key_header'
    • Zero breaking changes, enables smooth migration of legacy configurations

🎨 UI Component Types

  • Confirm Dialog (base/confirm/index.tsx)

    • Extended IConfirm type to include 'danger' option
  • Tool Labels (tools/labels/constant.ts)

    • Updated Label type to allow optional icon and string label
  • Tracing Config (models/app.ts)

    • Added TencentConfig to tracing configuration types

Files Changed (14)

web/app/components/app/annotation/index.tsx
web/app/components/app/annotation/list.tsx
web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx
web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
web/app/components/app/configuration/config-var/config-modal/index.tsx
web/app/components/app/configuration/config-var/index.tsx
web/app/components/app/configuration/config/agent/prompt-editor.tsx
web/app/components/app/configuration/debug/index.tsx
web/app/components/app/configuration/tools/index.tsx
web/app/components/app/create-from-dsl-modal/index.tsx
web/app/components/base/confirm/index.tsx
web/app/components/tools/labels/constant.ts
web/app/components/tools/types.ts
web/models/app.ts
web/package.json

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/27274 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary fix #27273 ### Changes #### 📦 Dependencies - **Update Lexical to v0.37.0** - Unified all `lexical` and `@lexical/*` packages to version 0.37.0 - Added pnpm overrides to prevent version conflicts - Fixes type incompatibility between lexical@0.36.2 and lexical@0.37.0 #### 🔧 Type Fixes **Component Refs & Event Handlers** - **Debug Component** (`debug/index.tsx`) - Fixed `RefObject<DebugWithSingleModelRefType>` type mismatch using non-null assertion - **Create from DSL Modal** (`create-from-dsl-modal/index.tsx`) - Updated `onCreate` function to accept optional `MouseEvent` parameter - Fixed `useDebounceFn` signature compatibility with keyboard shortcuts **Configuration Components** - **ConfigModal** (`config-var/config-modal/index.tsx`) - Ensured default value is properly typed as string for text inputs - **Prompt Inputs** (5 files) - Updated `onSaveCallback` to handle optional `ExternalDataTool` parameter - Affected files: - `config-prompt/advanced-prompt-input.tsx` - `config-prompt/simple-prompt-input.tsx` - `config-var/index.tsx` - `config/agent/prompt-editor.tsx` - `tools/index.tsx` **Annotation Components** - Removed unused `isBatchDeleting` state and prop from annotation components - Simplified state management in `annotation/index.tsx` and `annotation/list.tsx` #### 🔄 Backward Compatibility - **Tools AuthType** (`tools/types.ts`) - Added `AuthType.apiKey = 'api_key'` for backend compatibility - Backend supports both legacy `'api_key'` and current `'api_key_header'` - Zero breaking changes, enables smooth migration of legacy configurations #### 🎨 UI Component Types - **Confirm Dialog** (`base/confirm/index.tsx`) - Extended `IConfirm` type to include `'danger'` option - **Tool Labels** (`tools/labels/constant.ts`) - Updated `Label` type to allow optional icon and string label - **Tracing Config** (`models/app.ts`) - Added `TencentConfig` to tracing configuration types ### Files Changed (14) ``` web/app/components/app/annotation/index.tsx web/app/components/app/annotation/list.tsx web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx web/app/components/app/configuration/config-var/config-modal/index.tsx web/app/components/app/configuration/config-var/index.tsx web/app/components/app/configuration/config/agent/prompt-editor.tsx web/app/components/app/configuration/debug/index.tsx web/app/components/app/configuration/tools/index.tsx web/app/components/app/create-from-dsl-modal/index.tsx web/app/components/base/confirm/index.tsx web/app/components/tools/labels/constant.ts web/app/components/tools/types.ts web/models/app.ts web/package.json ``` <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> ## Screenshots | Before | After | |--------|-------| | ... | ... | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:50:02 -05:00
yindo closed this issue 2026-02-21 20:50:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31735