Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Revert "fix(api): prevent stale gallery star state"

joshistoast7be239289ab9
diff --git a/invokeai/app/api/routers/gallery.py b/invokeai/app/api/routers/gallery.py
index 92a5c6795c..0cecd05615 100644
--- a/invokeai/app/api/routers/gallery.py
+++ b/invokeai/app/api/routers/gallery.py
@@ -1,7 +1,7 @@
from datetime import date
from typing import Optional
-from fastapi import HTTPException, Query, Response
+from fastapi import HTTPException, Query
from fastapi.routing import APIRouter
from invokeai.app.api.auth_dependencies import CurrentUserOrDefault
@@ -13,7 +13,6 @@ from invokeai.app.services.shared.pagination import MAX_PAGE_SIZE, OffsetPaginat
from invokeai.app.services.shared.sqlite.sqlite_common import SQLiteDirection
gallery_router = APIRouter(prefix="/v1/gallery", tags=["gallery"])
-GALLERY_CACHE_CONTROL = "private, no-store"
@gallery_router.get(
@@ -23,7 +22,6 @@ GALLERY_CACHE_CONTROL = "private, no-store"
)
async def list_gallery_items(
current_user: CurrentUserOrDefault,
- response: Response,
origin: Optional[ResourceOrigin] = Query(default=None, description="The origin of items to list."),
categories: Optional[list[ImageCategory]] = Query(
default=None,
@@ -49,8 +47,6 @@ async def list_gallery_items(
),
) -> OffsetPaginatedResults[GalleryItem]:
"""Returns a paginated, time-sorted stream of polymorphic gallery items (images + videos)."""
- response.headers["Cache-Control"] = GALLERY_CACHE_CONTROL
-
if board_id is not None and board_id != "none":
_assert_board_read_access(board_id, current_user)
@@ -78,7 +74,6 @@ async def list_gallery_items(
)
async def get_gallery_item_names(
current_user: CurrentUserOrDefault,
- response: Response,
origin: Optional[ResourceOrigin] = Query(default=None, description="The origin of items to list."),
categories: Optional[list[ImageCategory]] = Query(
default=None,
@@ -100,8 +95,6 @@ async def get_gallery_item_names(
),
) -> GalleryItemNamesResult:
"""Returns an ordered (kind, name) list — used to drive virtualized gallery selection."""
- response.headers["Cache-Control"] = GALLERY_CACHE_CONTROL
-
if board_id is not None and board_id != "none":
_assert_board_read_access(board_id, current_user)
diff --git a/tests/app/routers/test_gallery.py b/tests/app/routers/test_gallery.py
index 31057bf467..ae1219fcd7 100644
--- a/tests/app/routers/test_gallery.py
+++ b/tests/app/routers/test_gallery.py
@@ -48,18 +48,6 @@ def test_gallery_list_endpoints_parse_and_forward_created_ranges(
assert kwargs["created_to"] == "2026-07-15"
[email protected]("path", ["/api/v1/gallery/items/", "/api/v1/gallery/items/names"])
-def test_gallery_list_endpoints_disable_browser_caching(
- monkeypatch: Any, mock_invoker: Invoker, client: TestClient, path: str
-) -> None:
- _prepare_gallery_router_test(monkeypatch, mock_invoker)
-
- response = client.get(path)
-
- assert response.status_code == 200
- assert response.headers["cache-control"] == "private, no-store"
-
-
@pytest.mark.parametrize("path", ["/api/v1/gallery/items/", "/api/v1/gallery/items/names"])
@pytest.mark.parametrize("param", ["created_from", "created_to"])
def test_gallery_list_endpoints_reject_invalid_created_range_dates(