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.

refactor(web): replace constructor parameter properties (#42691)

yyh1ff8a5ff4ffb
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 81d6cfed979..51c00aab7a9 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -1307,11 +1307,6 @@
"count": 3
}
},
- "web/app/components/base/image-uploader/__tests__/image-preview.spec.tsx": {
- "erasable-syntax-only/parameter-properties": {
- "count": 1
- }
- },
"web/app/components/base/image-uploader/__tests__/utils.spec.ts": {
"no-restricted-imports": {
"count": 1
@@ -1506,11 +1501,6 @@
"count": 1
}
},
- "web/app/components/base/prompt-editor/plugins/component-picker-block/menu.tsx": {
- "erasable-syntax-only/parameter-properties": {
- "count": 1
- }
- },
"web/app/components/base/prompt-editor/plugins/component-picker-block/prompt-option.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
diff --git a/web/app/components/base/image-uploader/__tests__/image-preview.spec.tsx b/web/app/components/base/image-uploader/__tests__/image-preview.spec.tsx
index 81e9cbe0b5a..26df56debe6 100644
--- a/web/app/components/base/image-uploader/__tests__/image-preview.spec.tsx
+++ b/web/app/components/base/image-uploader/__tests__/image-preview.spec.tsx
@@ -81,7 +81,11 @@ describe('ImagePreview', () => {
})
globalThis.ClipboardItem = class {
- constructor(public readonly data: Record<string, Blob | Promise<Blob>>) {}
+ public readonly data: Record<string, Blob | Promise<Blob>>
+
+ constructor(data: Record<string, Blob | Promise<Blob>>) {
+ this.data = data
+ }
} as unknown as typeof ClipboardItem
vi.spyOn(window, 'open').mockImplementation((...args: Parameters<Window['open']>) => {
return mocks.windowOpen(...args)
diff --git a/web/app/components/base/prompt-editor/plugins/component-picker-block/menu.tsx b/web/app/components/base/prompt-editor/plugins/component-picker-block/menu.tsx
index 52280000b83..5a0c469b354 100644
--- a/web/app/components/base/prompt-editor/plugins/component-picker-block/menu.tsx
+++ b/web/app/components/base/prompt-editor/plugins/component-picker-block/menu.tsx
@@ -11,18 +11,20 @@ type MenuOptionRenderProps = {
queryString: string | null
}
+type PickerBlockMenuOptionData = {
+ key: string
+ group?: string
+ onSelect?: () => void
+ render: (menuRenderProps: MenuOptionRenderProps) => React.JSX.Element
+}
+
export class PickerBlockMenuOption extends MenuOption {
+ private data: PickerBlockMenuOptionData
public group?: string
- constructor(
- private data: {
- key: string
- group?: string
- onSelect?: () => void
- render: (menuRenderProps: MenuOptionRenderProps) => React.JSX.Element
- },
- ) {
+ constructor(data: PickerBlockMenuOptionData) {
super(data.key)
+ this.data = data
this.group = data.group
}