Skip to content

Agentic UI: fix expired previews - #4298

Merged
nightnei merged 2 commits into
trunkfrom
agenticFixExpiredPreviews
Jul 23, 2026
Merged

Agentic UI: fix expired previews#4298
nightnei merged 2 commits into
trunkfrom
agenticFixExpiredPreviews

Conversation

@nightnei

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

AI assisted

Proposed Changes

In the issue STU-1978 we needed to come up with an approach for expired previews. The solution in testing instructions.

Testing Instructions

  1. Electron -> Feature Flags -> Enable Agentic UI
  2. Create a new site
  3. Click on:
    Screenshot 2026-07-22 at 12 52 50
  4. Assert that everythign looks as before
    Screenshot 2026-07-22 at 12 51 19
  5. Click on Share and wait till the preview is created
  6. Assert that you see "Preview published" and teh next content for preview section
    Screenshot 2026-07-22 at 12 56 12
  7. Open ~/.studio/cli.json
  8. Set date for your snapshot as 1784209999143
  9. Assert that you see "Preview updated 5 days ago"
    Screenshot 2026-07-22 at 12 58 24
  10. Set date for your snapshot as 1784109999143
  11. Assert that you see "Preview Expired", "The previous preview has expired." and button "Share a new one"
  12. Click on "Share a new one"
  13. Assert that it creates a preview
@nightnei nightnei self-assigned this Jul 22, 2026
@wpmobilebot

wpmobilebot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing ca51c16 vs trunk

app-size

Metric trunk ca51c16 Diff Change
App Size (Mac) 1362.03 MB 1361.90 MB 0.13 MB ⚪ 0.0%

site-editor

Metric trunk ca51c16 Diff Change
load 1026 ms 1066 ms +40 ms ⚪ 0.0%

site-startup

Metric trunk ca51c16 Diff Change
siteCreation 6507 ms 6519 ms +12 ms ⚪ 0.0%
siteStartup 2393 ms 2395 ms +2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Thanks for fixing the expired preview sites. I tested it by modifying the snapshots date in cli.json

Before After
Image Image
Comment on lines +15 to +23
// Mirrors the CLI's isSnapshotExpired (apps/cli/lib/snapshots.ts). The CLI
// refuses to update an expired preview site, so the UI must offer creating a
// new one instead of an update.
export function isSnapshotExpired( snapshot: Snapshot ): boolean {
return (
normalizeSnapshotTimestamp( snapshot.date ) + DEMO_SITE_EXPIRATION_DAYS * DAY_MS < Date.now()
);
}

@sejas sejas Jul 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could consider unifying the isSnapshotExpired function under a module packages/common/lib to use it in the UI and CLI

export function isSnapshotExpired( snapshot: Snapshot ) {
const now = new Date();
const endDate = addDays( snapshot.date, DEMO_SITE_EXPIRATION_DAYS );
return endDate < now;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, done

@nightnei
nightnei enabled auto-merge (squash) July 23, 2026 11:29
@nightnei
nightnei merged commit 4ad065c into trunk Jul 23, 2026
15 checks passed
@nightnei
nightnei deleted the agenticFixExpiredPreviews branch July 23, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants