Skip to content

feat(a2ui-playground): persist and reuse the conversation share link#2805

Merged
PupilTong merged 1 commit into
lynx-family:mainfrom
PupilTong:claude/persist-share-link
Jun 5, 2026
Merged

feat(a2ui-playground): persist and reuse the conversation share link#2805
PupilTong merged 1 commit into
lynx-family:mainfrom
PupilTong:claude/persist-share-link

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Jun 5, 2026

Sharing a conversation uploads the serialized document and builds an import link. Because each upload uses a fresh random storage path, every Share click — and every share after a page reload — minted a different link for the same, unchanged conversation.

Persist the published document URL on the conversation's IndexedDB snapshot, paired with the meta.updatedAt it was generated for, and reuse it while the conversation is unchanged. Repeated shares (within a session and across reloads) now copy the same link; a new turn or rename bumps updatedAt (and a turn also rewrites the snapshot), so the link refreshes exactly when the shared content changes.

  • types.ts: DataModelSnapshot.sharePayload { url, updatedAt }
  • conversationRepo.ts: saveConversationSharePayload()
  • AIChatPage.tsx: shareConversation reuses the persisted URL, or uploads and persists a fresh one

Summary by CodeRabbit

  • Bug Fixes
    • Improved conversation sharing efficiency. When sharing a conversation multiple times without making changes, the system now reuses the previously published share link instead of creating a duplicate. This reduces unnecessary processing and ensures consistent share URLs for unchanged conversations.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

Sharing a conversation uploads the serialized document and builds an
import link. Because each upload uses a fresh random storage path, every
Share click — and every share after a page reload — minted a different
link for the same, unchanged conversation.

Persist the published document URL on the conversation's IndexedDB
snapshot, paired with the meta.updatedAt it was generated for, and reuse
it while the conversation is unchanged. Repeated shares (within a session
and across reloads) now copy the same link; a new turn or rename bumps
updatedAt (and a turn also rewrites the snapshot), so the link refreshes
exactly when the shared content changes.

- types.ts: DataModelSnapshot.sharePayload { url, updatedAt }
- conversationRepo.ts: saveConversationSharePayload()
- AIChatPage.tsx: shareConversation reuses the persisted URL, or uploads
  and persists a fresh one
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

⚠️ No Changeset found

Latest commit: 6cf20be

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff9450a1-65b9-4261-867e-ac58c71e8201

📥 Commits

Reviewing files that changed from the base of the PR and between e33c08f and 6cf20be.

📒 Files selected for processing (3)
  • packages/genui/a2ui-playground/src/pages/AIChatPage.tsx
  • packages/genui/a2ui-playground/src/storage/conversationRepo.ts
  • packages/genui/a2ui-playground/src/storage/types.ts

📝 Walkthrough

Walkthrough

This PR adds persistent caching of conversation share URLs. The DataModelSnapshot schema now stores a cached share URL alongside the conversation's updatedAt timestamp. The shareConversation function checks whether the cached URL is valid (matching timestamps); if so, it reuses the existing URL; otherwise, it publishes a fresh share URL and persists it via a new saveConversationSharePayload() helper function.

Changes

Share URL Caching

Layer / File(s) Summary
Share payload data model
packages/genui/a2ui-playground/src/storage/types.ts
DataModelSnapshot gains an optional sharePayload field containing a durable share URL and its corresponding updatedAt timestamp for cache validation.
Share payload persistence
packages/genui/a2ui-playground/src/storage/conversationRepo.ts
New exported saveConversationSharePayload() function transactionally updates a conversation snapshot's sharePayload field in the snapshots store.
Conversation sharing with cache reuse
packages/genui/a2ui-playground/src/pages/AIChatPage.tsx
The shareConversation function reuses a cached share URL when its updatedAt matches the current conversation's updatedAt; otherwise it serializes, publishes a new URL, and persists it via saveConversationSharePayload().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • lynx-family/lynx-stack#2770: Modifies the GenUI playground's conversation sharing flow, adding "share conversation" behavior that this PR further extends with URL caching and persistence.
  • lynx-family/lynx-stack#2795: Modifies the conversation share flow and extends conversationRepo.ts share infrastructure; this PR builds on that earlier sharing/import design with added reuse and caching.

Suggested reviewers

  • HuJean
  • Sherry-hue
  • gaoachao

Poem

🐰 A share link cached, no more re-share,
Same URL blooms, the code grows fair,
Snapshot remembers what once was true,
Till conversation changes anew,
Efficiency hops through with glee! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main objective of the changeset: persisting and reusing conversation share links to avoid unnecessary re-uploads.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will degrade performance by 42.85%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 85 untouched benchmarks
⏩ 26 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation basic-performance-large-css 16.2 ms 55.4 ms -70.69%
Simulation transform 1000 view elements 44.9 ms 40.3 ms +11.4%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing PupilTong:claude/persist-share-link (6cf20be) with main (e33c08f)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@PupilTong PupilTong enabled auto-merge (squash) June 5, 2026 08:37
@PupilTong PupilTong merged commit d40db27 into lynx-family:main Jun 5, 2026
75 of 78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants