mirror of
https://github.com/langgenius/dify.git
synced 2025-11-25 09:23:37 +00:00
Fix frontend type error (#27116)
This commit is contained in:
parent
dc1a380888
commit
8c298b33cd
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import type { ReactNode, RefObject } from 'react'
|
||||
import {
|
||||
useMemo,
|
||||
useRef,
|
||||
@ -17,7 +17,7 @@ import { PLUGIN_PAGE_TABS_MAP, usePluginPageTabs } from '../hooks'
|
||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||
|
||||
export type PluginPageContextValue = {
|
||||
containerRef: React.RefObject<HTMLDivElement>
|
||||
containerRef: RefObject<HTMLDivElement | null>
|
||||
currentPluginID: string | undefined
|
||||
setCurrentPluginID: (pluginID?: string) => void
|
||||
filters: FilterState
|
||||
@ -27,8 +27,10 @@ export type PluginPageContextValue = {
|
||||
options: Array<{ value: string, text: string }>
|
||||
}
|
||||
|
||||
const emptyContainerRef: RefObject<HTMLDivElement | null> = { current: null }
|
||||
|
||||
export const PluginPageContext = createContext<PluginPageContextValue>({
|
||||
containerRef: { current: null },
|
||||
containerRef: emptyContainerRef,
|
||||
currentPluginID: undefined,
|
||||
setCurrentPluginID: noop,
|
||||
filters: {
|
||||
@ -53,7 +55,7 @@ export function usePluginPageContext(selector: (value: PluginPageContextValue) =
|
||||
export const PluginPageContextProvider = ({
|
||||
children,
|
||||
}: PluginPageContextProviderProps) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const containerRef = useRef<HTMLDivElement | null>(null)
|
||||
const [filters, setFilters] = useState<FilterState>({
|
||||
categories: [],
|
||||
tags: [],
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import type { RefObject } from 'react'
|
||||
|
||||
type UploaderHookProps = {
|
||||
onFileChange: (file: File | null) => void
|
||||
containerRef: React.RefObject<HTMLDivElement>
|
||||
containerRef: RefObject<HTMLDivElement | null>
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ const i18nPrefix = 'plugin.upgrade'
|
||||
|
||||
type Props = {
|
||||
payload: UpdateFromMarketPlacePayload
|
||||
pluginId: string
|
||||
pluginId?: string
|
||||
onSave: () => void
|
||||
onCancel: () => void
|
||||
isShowDowngradeWarningModal?: boolean
|
||||
@ -113,9 +113,11 @@ const UpdatePluginModal: FC<Props> = ({
|
||||
const { mutateAsync } = useRemoveAutoUpgrade()
|
||||
const invalidateReferenceSettings = useInvalidateReferenceSettings()
|
||||
const handleExcludeAndDownload = async () => {
|
||||
await mutateAsync({
|
||||
plugin_id: pluginId,
|
||||
})
|
||||
if (pluginId) {
|
||||
await mutateAsync({
|
||||
plugin_id: pluginId,
|
||||
})
|
||||
}
|
||||
invalidateReferenceSettings()
|
||||
handleConfirm()
|
||||
}
|
||||
|
||||
@ -145,6 +145,9 @@ export const usePipelineRun = () => {
|
||||
} = workflowStore.getState()
|
||||
setWorkflowRunningData({
|
||||
result: {
|
||||
inputs_truncated: false,
|
||||
process_data_truncated: false,
|
||||
outputs_truncated: false,
|
||||
status: WorkflowRunningStatus.Running,
|
||||
},
|
||||
tracing: [],
|
||||
|
||||
@ -164,6 +164,9 @@ export const useWorkflowRun = () => {
|
||||
} = workflowStore.getState()
|
||||
setWorkflowRunningData({
|
||||
result: {
|
||||
inputs_truncated: false,
|
||||
process_data_truncated: false,
|
||||
outputs_truncated: false,
|
||||
status: WorkflowRunningStatus.Running,
|
||||
},
|
||||
tracing: [],
|
||||
|
||||
@ -86,7 +86,7 @@ const WorkflowAppWithAdditionalContext = () => {
|
||||
if (!parsedInputs)
|
||||
return
|
||||
|
||||
const userInputs: Record<string, string> = {}
|
||||
const userInputs: Record<string, string | number | boolean> = {}
|
||||
Object.entries(parsedInputs).forEach(([key, value]) => {
|
||||
if (key.startsWith('sys.'))
|
||||
return
|
||||
|
||||
@ -11,7 +11,7 @@ import { noop } from 'lodash-es'
|
||||
import { getMarketplaceUrl } from '@/utils/var'
|
||||
|
||||
export type ListProps = {
|
||||
wrapElemRef: React.RefObject<HTMLElement>
|
||||
wrapElemRef: React.RefObject<HTMLElement | null>
|
||||
list: Plugin[]
|
||||
searchText: string
|
||||
tags: string[]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user