[PR #27331] refactor: update installed app component to handle missing params and improve type safety #31742

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

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

State: closed
Merged: Yes


add constants for OAuth authorization; refactor app detail fetching logic; enhance configuration components with new properties and types; implement ELK layout utility for workflow components

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 #27327

📁 app routes

web/app/(commonLayout)/explore/installed/[appId]/page.tsx

  • Fix: Remove await params; destructure synchronously for type-safe PageProps.

web/app/account/oauth/authorize/constants.ts

  • New module: Exports

    • OAUTH_AUTHORIZE_PENDING_KEY
    • REDIRECT_URL_KEY
    • OAUTH_AUTHORIZE_PENDING_TTL

web/app/account/oauth/authorize/page.tsx

  • Refactor: Consume new constants module.
  • Cleanup: Remove inline key definitions.

🧠 App Components

web/app/components/app/app-publisher/index.tsx

  • Fetch updated app detail via fetchAppDetailDirect.
  • Toggle publish state safely on reopen.
  • Reset published flag consistently.

web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx

  • Clone default prompt configs when not in advanced mode.
  • Include system parameters and external data tools in request payload.

web/app/components/app/configuration/debug/debug-with-single-model/index.tsx

  • Update regenerate handler signature to accept optional edited question payload.

web/app/components/app/configuration/debug/hooks.tsx

  • Build ChatConfig with:

    • Cloned default prompts
    • Real system parameters
    • File-upload settings
    • External-data-tool configuration

web/app/components/app/configuration/debug/index.tsx

  • Integrate system parameters & external tools into debug send flow.
  • Include these fields in formatting change checks.

web/app/components/app/configuration/index.tsx

  • Initialize model config with full default shape:

    • Prompt configs
    • System parameters
    • External tools
  • Handle dataset selection & rerank recalculation.

  • Merge external data tools into prompt variable export.

  • Normalize agent tool list.


💬 Chat Components

web/app/components/base/chat/chat-with-history/chat-wrapper.tsx

  • Use localization helper for welcome message icons/text.

web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx

  • Same localization update as above.

web/app/components/base/chat/types.ts

  • Extend OnRegenerate signature to accept optional edited question/files.

🕓 Date & Time Picker

web/app/components/base/date-and-time-picker/time-picker/index.spec.tsx

  • Provide required props (value, children) after type tightening.

web/app/components/base/date-and-time-picker/utils/dayjs.ts

  • Replace deprecated dayjs.tz overload with .tz(..., true) guard.

🧱 Base Components

web/app/components/base/form/types.ts

  • Update FieldValidators alias to match current 12-parameter generic arity.

web/app/components/base/markdown-blocks/think-block.tsx

  • Safely track data-think attribute.
  • Manage timer ref types.
  • Control open state and summary layout.

web/app/components/base/popover/index.tsx

  • Guard cloneElement with isValidElement.
  • Avoid spreading unknown props into portal container.

web/app/components/base/portal-to-follow-elem/index.tsx

  • Accept nullable refs.
  • Shallow-clone child props before spread to prevent errors.

web/app/components/base/prompt-editor/hooks.ts

  • Allow RefObject<HTMLDivElement | null> in returned tuple.

web/app/components/base/prompt-editor/plugins/placeholder.tsx

  • Accept ReactNode values for placeholder text.

web/app/components/base/voice-input/utils.ts

  • Convert MP3 buffers to ArrayBuffer explicitly to avoid SharedArrayBuffer incompatibility.

💳 Billing

web/app/components/billing/pricing/index.tsx

  • Remove enterprise→team type coercion.
  • Pass plan through unchanged.

web/app/components/billing/pricing/plans/index.tsx

  • Introduce currentPlanType for comparison (clamps enterprise).
  • Keep display plan intact.

📚 Datasets

web/app/components/datasets/create/embedding-process/index.tsx

  • Add type guards for notion/web data-source preview fields.

web/app/components/datasets/create/file-uploader/index.tsx

  • Maintain original File object in upload result.
  • Attach id / progress metadata.

web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/index.tsx

  • Apply same enriched File handling as uploader.

web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx

  • Same enriched File handling for CSV uploads.

web/app/components/datasets/documents/detail/index.tsx

  • Derive upload file info via discriminated union (instead of assuming legacy shape).

web/app/components/datasets/documents/detail/metadata/index.tsx

  • Treat 'others' doc type as empty state.
  • Maintain metadata typing.
  • Update radio behavior.

web/app/components/datasets/documents/detail/settings/document-settings.tsx

  • Add discriminated type guards for legacy/local/notion/web sources.
  • Supply file lists, crawl provider/job id, and crawl options accordingly.

⚙️ Header Components

web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx

  • Align feature filters with ModelFeatureEnum.

web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx

  • Type scopeFeatures as ModelFeatureEnum[].

🔌 Plugins

web/app/components/plugins/install-plugin/utils.ts

  • Ensure plugin cards include:

    • Labels
    • Descriptions
    • Badges
    • Source metadata
  • Map tags to expected shape.

web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx

  • Relax schema iteration typing (any) after shape changes.

web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx

  • Cast scope features to ModelFeatureEnum.

🧰 Tools

web/app/components/tools/add-tool-modal/category.tsx

  • Add i18n helper for labels.
  • Guard against missing icons.

web/app/components/tools/add-tool-modal/index.tsx

  • Coerce tool.provider_type to CollectionType when mutating config.

web/app/components/tools/add-tool-modal/tools.tsx

  • Reuse label localization helper across labels and descriptions.

🔁 Workflow

web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx

  • Update regenerate call to accept edited question payload.

web/app/components/workflow/utils/elk-layout.ts (renamed from layout.ts)

  • Relocate ELK layout implementation to dedicated file.

web/app/components/workflow/utils/index.ts

  • Re-export from new ./elk-layout.

🔐 Auth & Redirects

web/app/signin/utils/post-login-redirect.ts

  • Import OAuth constants from new constants module.

🧩 Contexts & Models

web/context/debug-configuration.ts

  • Expand default config with:

    • Full prompt
    • System parameters
    • External data tools

web/models/datasets.ts

  • Extend WebsiteCrawlInfo with optional:

    • provider
    • job_id

web/models/debug.ts

  • Augment ModelConfig with optional:

    • Prompt configs
    • External-data tools
    • System parameters schema

web/types/app.ts

  • Mirror ModelConfig updates on app-facing types:

    • System parameters
    • External data tools
    • Strict prompt configs

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/27331 **State:** closed **Merged:** Yes --- add constants for OAuth authorization; refactor app detail fetching logic; enhance configuration components with new properties and types; implement ELK layout utility for workflow components > [!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 #27327 ## 📁 app routes ### `web/app/(commonLayout)/explore/installed/[appId]/page.tsx` * **Fix:** Remove `await params`; destructure synchronously for type-safe `PageProps`. ### `web/app/account/oauth/authorize/constants.ts` * **New module:** Exports * `OAUTH_AUTHORIZE_PENDING_KEY` * `REDIRECT_URL_KEY` * `OAUTH_AUTHORIZE_PENDING_TTL` ### `web/app/account/oauth/authorize/page.tsx` * **Refactor:** Consume new constants module. * **Cleanup:** Remove inline key definitions. --- ## 🧠 App Components ### `web/app/components/app/app-publisher/index.tsx` * Fetch updated app detail via `fetchAppDetailDirect`. * Toggle publish state safely on reopen. * Reset published flag consistently. ### `web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx` * Clone default prompt configs when not in advanced mode. * Include system parameters and external data tools in request payload. ### `web/app/components/app/configuration/debug/debug-with-single-model/index.tsx` * Update regenerate handler signature to accept optional edited question payload. ### `web/app/components/app/configuration/debug/hooks.tsx` * Build `ChatConfig` with: * Cloned default prompts * Real system parameters * File-upload settings * External-data-tool configuration ### `web/app/components/app/configuration/debug/index.tsx` * Integrate system parameters & external tools into debug send flow. * Include these fields in formatting change checks. ### `web/app/components/app/configuration/index.tsx` * Initialize model config with full default shape: * Prompt configs * System parameters * External tools * Handle dataset selection & rerank recalculation. * Merge external data tools into prompt variable export. * Normalize agent tool list. --- ## 💬 Chat Components ### `web/app/components/base/chat/chat-with-history/chat-wrapper.tsx` * Use localization helper for welcome message icons/text. ### `web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx` * Same localization update as above. ### `web/app/components/base/chat/types.ts` * Extend `OnRegenerate` signature to accept optional edited question/files. --- ## 🕓 Date & Time Picker ### `web/app/components/base/date-and-time-picker/time-picker/index.spec.tsx` * Provide required props (`value`, `children`) after type tightening. ### `web/app/components/base/date-and-time-picker/utils/dayjs.ts` * Replace deprecated `dayjs.tz` overload with `.tz(..., true)` guard. --- ## 🧱 Base Components ### `web/app/components/base/form/types.ts` * Update `FieldValidators` alias to match current 12-parameter generic arity. ### `web/app/components/base/markdown-blocks/think-block.tsx` * Safely track `data-think` attribute. * Manage timer ref types. * Control open state and summary layout. ### `web/app/components/base/popover/index.tsx` * Guard `cloneElement` with `isValidElement`. * Avoid spreading unknown props into portal container. ### `web/app/components/base/portal-to-follow-elem/index.tsx` * Accept nullable refs. * Shallow-clone child props before spread to prevent errors. ### `web/app/components/base/prompt-editor/hooks.ts` * Allow `RefObject<HTMLDivElement | null>` in returned tuple. ### `web/app/components/base/prompt-editor/plugins/placeholder.tsx` * Accept `ReactNode` values for placeholder text. ### `web/app/components/base/voice-input/utils.ts` * Convert MP3 buffers to `ArrayBuffer` explicitly to avoid `SharedArrayBuffer` incompatibility. --- ## 💳 Billing ### `web/app/components/billing/pricing/index.tsx` * Remove enterprise→team type coercion. * Pass plan through unchanged. ### `web/app/components/billing/pricing/plans/index.tsx` * Introduce `currentPlanType` for comparison (clamps enterprise). * Keep display plan intact. --- ## 📚 Datasets ### `web/app/components/datasets/create/embedding-process/index.tsx` * Add type guards for notion/web data-source preview fields. ### `web/app/components/datasets/create/file-uploader/index.tsx` * Maintain original `File` object in upload result. * Attach `id` / `progress` metadata. ### `web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/index.tsx` * Apply same enriched `File` handling as uploader. ### `web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx` * Same enriched `File` handling for CSV uploads. ### `web/app/components/datasets/documents/detail/index.tsx` * Derive upload file info via discriminated union (instead of assuming legacy shape). ### `web/app/components/datasets/documents/detail/metadata/index.tsx` * Treat `'others'` doc type as empty state. * Maintain metadata typing. * Update radio behavior. ### `web/app/components/datasets/documents/detail/settings/document-settings.tsx` * Add discriminated type guards for legacy/local/notion/web sources. * Supply file lists, crawl provider/job id, and crawl options accordingly. --- ## ⚙️ Header Components ### `web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx` * Align feature filters with `ModelFeatureEnum`. ### `web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx` * Type `scopeFeatures` as `ModelFeatureEnum[]`. --- ## 🔌 Plugins ### `web/app/components/plugins/install-plugin/utils.ts` * Ensure plugin cards include: * Labels * Descriptions * Badges * Source metadata * Map tags to expected shape. ### `web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx` * Relax schema iteration typing (`any`) after shape changes. ### `web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx` * Cast scope features to `ModelFeatureEnum`. --- ## 🧰 Tools ### `web/app/components/tools/add-tool-modal/category.tsx` * Add i18n helper for labels. * Guard against missing icons. ### `web/app/components/tools/add-tool-modal/index.tsx` * Coerce `tool.provider_type` to `CollectionType` when mutating config. ### `web/app/components/tools/add-tool-modal/tools.tsx` * Reuse label localization helper across labels and descriptions. --- ## 🔁 Workflow ### `web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx` * Update regenerate call to accept edited question payload. ### `web/app/components/workflow/utils/elk-layout.ts` *(renamed from layout.ts)* * Relocate ELK layout implementation to dedicated file. ### `web/app/components/workflow/utils/index.ts` * Re-export from new `./elk-layout`. --- ## 🔐 Auth & Redirects ### `web/app/signin/utils/post-login-redirect.ts` * Import OAuth constants from new constants module. --- ## 🧩 Contexts & Models ### `web/context/debug-configuration.ts` * Expand default config with: * Full prompt * System parameters * External data tools ### `web/models/datasets.ts` * Extend `WebsiteCrawlInfo` with optional: * `provider` * `job_id` ### `web/models/debug.ts` * Augment `ModelConfig` with optional: * Prompt configs * External-data tools * System parameters schema ### `web/types/app.ts` * Mirror `ModelConfig` updates on app-facing types: * System parameters * External data tools * Strict prompt configs <!-- 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:03 -05:00
yindo closed this issue 2026-02-21 20:50:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31742