File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed
invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -96,13 +96,17 @@ const WorkflowGeneralTab = () => {
96
96
< FormLabel > { t ( 'nodes.workflowName' ) } </ FormLabel >
97
97
< Input variant = "darkFilled" value = { name } onChange = { handleChangeName } />
98
98
</ FormControl >
99
- { /* we should not show this field if default workflow or not saved to DB yet */ }
100
- { /* {data?.meta.category !== 'default' || !data.workflow_id && ( */ }
101
- < FormControl >
102
- < FormLabel > { t ( 'workflows.workflowThumbnail' ) } </ FormLabel >
103
- < WorkflowThumbnailEditor thumbnailUrl = { data ?. thumbnail_url || null } workflowId = { id } />
104
- </ FormControl >
105
- { /* )} */ }
99
+ { /*
100
+ * Only saved and non-default workflows can have a thumbnail.
101
+ * - Unsaved workflows have no id.
102
+ * - Default workflows have a category of 'default'.
103
+ */ }
104
+ { id && data && data . workflow . meta . category !== 'default' && (
105
+ < FormControl >
106
+ < FormLabel > { t ( 'workflows.workflowThumbnail' ) } </ FormLabel >
107
+ < WorkflowThumbnailEditor thumbnailUrl = { data . thumbnail_url } workflowId = { id } />
108
+ </ FormControl >
109
+ ) }
106
110
< FormControl >
107
111
< FormLabel > { t ( 'nodes.workflowVersion' ) } </ FormLabel >
108
112
< Input variant = "darkFilled" value = { version } onChange = { handleChangeVersion } />
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ export const WorkflowThumbnailEditor = ({
11
11
workflowId,
12
12
thumbnailUrl,
13
13
} : {
14
- workflowId ? : string ;
15
- thumbnailUrl : string | null ;
14
+ workflowId : string ;
15
+ thumbnailUrl ? : string | null ;
16
16
} ) => {
17
17
const { t } = useTranslation ( ) ;
18
18
@@ -28,10 +28,6 @@ export const WorkflowThumbnailEditor = ({
28
28
} , [ ] ) ;
29
29
30
30
const handleSaveChanges = useCallback ( async ( ) => {
31
- if ( ! workflowId ) {
32
- return ;
33
- }
34
-
35
31
try {
36
32
if ( localThumbnailUrl ) {
37
33
const blob = await convertImageUrlToBlob ( localThumbnailUrl ) ;
Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ export const WorkflowThumbnailField = ({
9
9
imageUrl,
10
10
onChange,
11
11
} : {
12
- imageUrl : string | null ;
12
+ imageUrl ? : string | null ;
13
13
onChange : ( localThumbnailUrl : string | null ) => void ;
14
14
} ) => {
15
15
const [ thumbnail , setThumbnail ] = useState < File | null > ( null ) ;
16
16
17
- const syncThumbnail = useCallback ( async ( imageUrl : string | null ) => {
17
+ const syncThumbnail = useCallback ( async ( imageUrl ? : string | null ) => {
18
18
if ( ! imageUrl ) {
19
19
setThumbnail ( null ) ;
20
20
return ;
You can’t perform that action at this time.
0 commit comments