Skip to content

Cached presigned URLs may expire in long-lived sessions #16

@okamoto-aws

Description

@okamoto-aws

Problem

stablePreviewUrls in useWorkspace.ts caches the first presigned URL per slide to prevent unnecessary image re-downloads during polling. However, this cache is only cleared on:

  • Deck switch (new activeDeckId)
  • pptxRequested trigger

If a user keeps a deck open for an extended period without triggering either condition, the cached presigned URLs will expire (S3 default is typically 15 min to 1 hour). After expiry, <img> elements will show broken images since the cached URLs are no longer valid.

Suggested Fix

Options (pick one):

  1. TTL-based cache eviction - Store timestamp alongside URL, clear entries older than N minutes
  2. <img onError> retry - On image load failure, evict the cached URL for that slideId and trigger a re-fetch
  3. Periodic cache clear - Clear stablePreviewUrls every N minutes regardless of user action

Option 2 is probably the lightest touch since it only triggers on actual failure.

Context

Introduced in PR #15 (fix/preview-polling-redownload). The URL stabilisation cache is correct for its intended purpose; this issue tracks the edge case of long-lived sessions.

Files

  • web-ui/src/hooks/useWorkspace.ts - stablePreviewUrls ref

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions