Skip to content

Commit c4183ec

Browse files
Mary Hippmaryhipp
authored andcommitted
add with_hash to prevent rerenders on default
1 parent 5a9cbe3 commit c4183ec

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

invokeai/app/services/workflow_thumbnails/workflow_thumbnails_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class WorkflowThumbnailServiceBase(ABC):
88
"""Base class for workflow thumbnail services"""
99

1010
@abstractmethod
11-
def get_path(self, workflow_id: str) -> Path:
11+
def get_path(self, workflow_id: str, with_hash: bool = True) -> Path:
1212
"""Gets the path to a workflow thumbnail"""
1313
pass
1414

1515
@abstractmethod
16-
def get_url(self, workflow_id: str) -> str | None:
16+
def get_url(self, workflow_id: str, with_hash: bool = True) -> str | None:
1717
"""Gets the URL of a workflow thumbnail"""
1818
pass
1919

invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def save(self, workflow_id: str, image: PILImageType) -> None:
4141
except Exception as e:
4242
raise WorkflowThumbnailFileSaveException from e
4343

44-
def get_path(self, workflow_id: str) -> Path:
44+
def get_path(self, workflow_id: str, with_hash: bool = True) -> Path:
4545
workflow = self._invoker.services.workflow_records.get(workflow_id).workflow
4646
if workflow.meta.category is WorkflowCategory.Default:
4747
default_thumbnails_dir = Path(__file__).parent / Path("default_workflow_thumbnails")
@@ -51,15 +51,16 @@ def get_path(self, workflow_id: str) -> Path:
5151

5252
return path
5353

54-
def get_url(self, workflow_id: str) -> str | None:
54+
def get_url(self, workflow_id: str, with_hash: bool = True) -> str | None:
5555
path = self.get_path(workflow_id)
5656
if not self._validate_path(path):
5757
return
5858

5959
url = self._invoker.services.urls.get_workflow_thumbnail_url(workflow_id)
6060

6161
# The image URL never changes, so we must add random query string to it to prevent caching
62-
url += f"?{uuid_string()}"
62+
if with_hash:
63+
url += f"?{uuid_string()}"
6364

6465
return url
6566

0 commit comments

Comments
 (0)