fix: Fix workflow replay after updating starting URL (#2773)

Resolves https://github.com/webrecorder/browsertrix/issues/2764

## Changes

Uses crawl first seed as starting URL instead of workflow first seed to
fix replay after saving workflow without running.

## Manual testing

1. Log in as crawler
2. Create a new workflow and crawl a single page, for example,
https://example.com/
3. Edit the workflow to change starting URL to https://example.org/
4. Save without running
5. Go to latest crawl tab, verify replay loads https://example.com/
This commit is contained in:
sua yoo 2025-07-25 15:52:28 -07:00 committed by GitHub
parent 1824fa0757
commit 04f5ec856f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1891,7 +1891,9 @@ export class WorkflowDetail extends BtrixElement {
return html`
<div class="aspect-video overflow-hidden rounded-lg border">
${guard([this.lastCrawlId], this.renderReplay)}
${guard([this.lastCrawlId], () =>
when(this.latestCrawlTask.value, this.renderReplay),
)}
</div>
`;
};
@ -1958,18 +1960,15 @@ export class WorkflowDetail extends BtrixElement {
`;
}
private readonly renderReplay = () => {
if (!this.workflow || !this.lastCrawlId) return;
const replaySource = `/api/orgs/${this.workflow.oid}/crawls/${this.lastCrawlId}/replay.json`;
private readonly renderReplay = (latestCrawl: Crawl) => {
const replaySource = `/api/orgs/${latestCrawl.oid}/crawls/${this.lastCrawlId}/replay.json`;
const headers = this.authState?.headers;
const config = JSON.stringify({ headers });
return html`
<replay-web-page
source="${replaySource}"
url="${(this.workflow.seedCount === 1 && this.workflow.firstSeed) ||
""}"
url="${(latestCrawl.seedCount === 1 && latestCrawl.firstSeed) || ""}"
config="${config}"
replayBase="/replay/"
noSandbox="true"