Skip to content

fix(edit-track): regenerate the preview when the preview start changes - #14556

Merged
rickyrombo merged 1 commit into
mainfrom
fix/edit-track-preview-regeneration
Aug 8, 2026
Merged

fix(edit-track): regenerate the preview when the preview start changes#14556
rickyrombo merged 1 commit into
mainfrom
fix/edit-track-preview-regeneration

Conversation

@rickyrombo

Copy link
Copy Markdown
Contributor

Follow-up bug fix from the content-auth review of #14550/#14552 — independent of the redesign in #14555, works against today's servers.

The bug

useUpdateTrack never passes generatePreview to sdk.tracks.updateTrack, and the SDK's updateTrack only calls generate_preview when that flag is set. So editing a gated track's preview start point updates preview_start_seconds in the track metadata while the track keeps streaming the old preview_cid's clip — the preview is never re-sliced at the new offset. As far as I can trace, nothing else regenerates it (populateTrackMetadataWithUploadResponseV2 only touches previewCid when a new audio file was uploaded).

The fix

Pass generatePreview: true when the preview start is set and differs from the cached previous track's value:

  • The SDK already guards the rest: it skips regeneration when a new audioFile is present (transcoding produces the preview then) and when previewStartSeconds is undefined.
  • A cache miss for the previous track errs toward regenerating, which is idempotent for an unchanged offset.

Once #14555 lands, this call site inherits the attributed generate_preview request automatically — updateTrack threads its userId internally.

Testing

packages/common typechecks clean; eslint clean on the touched file.

🤖 Generated with Claude Code

The edit flow never passed generatePreview to sdk.tracks.updateTrack, and
the SDK only regenerates a preview when asked. Editing a gated track's
preview start point therefore updated preview_start_seconds in metadata
while the track kept streaming the clip at the old offset — the stored
preview_cid was never replaced.

Pass generatePreview when the preview start is set and differs from the
cached previous value. The SDK already skips regeneration when a new audio
file is uploaded (transcoding produces the preview then), so this only
fires on metadata-only edits. A cache miss for the previous track errs on
the side of regenerating, which is idempotent for the same offset.

Found while tracing the client preview flows during the content-auth
review: the only current caller of updateTrack's generatePreview branch
was nobody.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 02aa3e3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rickyrombo
rickyrombo merged commit defdd9a into main Aug 8, 2026
17 checks passed
@rickyrombo
rickyrombo deleted the fix/edit-track-preview-regeneration branch August 8, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant