Skip to content

fix: make sure update preview text when source file has been changed … - #292

Open
moonrailgun wants to merge 1 commit into
Narcooo:masterfrom
moonrailgun:moonrailgun-fix-preview-refresh
Open

moonrailgun wants to merge 1 commit into
Narcooo:masterfrom
moonrailgun:moonrailgun-fix-preview-refresh

Conversation

@moonrailgun

Copy link
Copy Markdown

…by agent

Summary

  • Refresh the Studio artifact preview when an agent changes the underlying chapter or content file.
  • Preserve the current preview scroll position when refreshing the same chapter/file.
  • Add regression coverage for preview refresh and direct chat edit change signaling.

Type of change

  • Bug fix
  • New feature
  • Refactor (no behavior change)
  • Docs / SKILL.md
  • Test
  • Performance

Motivation (optional)

When the agent edited the currently open chapter, the right-side Studio preview could keep showing stale content until the user reopened or refreshed the view. Refreshing also disturbed the preview scroll position.

Changes

File Change
packages/studio/src/components/chat/BookSidebar.tsx Refetches open artifact previews on book data changes and preserves scroll position for same-artifact refreshes.
packages/studio/src/components/chat/BookSidebar.test.ts Adds regression checks for artifact refetch behavior and scroll preservation.
packages/studio/src/api/server.ts Returns details.contentChanged for direct chat edits so the frontend can detect content changes.
packages/studio/src/api/server.test.ts Verifies direct chapter edits return content change metadata.
packages/studio/src/store/chat/slices/message/action.ts Bumps bookDataVersion when /agent reports changed content.
packages/studio/src/store/chat/types.ts Adds the contentChanged response type for agent responses.

Usage (optional)

Test plan

  • pnpm typecheck passes
  • pnpm test passes (all existing + new tests)
  • Manual verification:
    open a chapter preview in Studio, ask the agent to edit that chapter, confirm the preview text updates while the scroll position stays unchanged

Breaking changes (optional)

None

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.

1 participant