Repository navigation
feat(blog): add resilient uploads and virtualized chat - #9
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideThe PR replaces direct multipart blog uploads with a shared, retryable staged-asset workflow across content and chat surfaces, adds idempotent/autosaved moment drafting, virtualizes long variable-height chat histories, tightens media validation and styling, and enforces the resulting performance and contract requirements in CI. Sequence diagram for resilient staged media uploadssequenceDiagram
participant User
participant UploadQueue
participant API as BlogAPI
participant MediaService
participant ContentAPI
User->>UploadQueue: setFiles(files)
UploadQueue->>API: POST media/upload
API->>MediaService: POST /api/media/upload
MediaService-->>API: staged asset
API-->>UploadQueue: asset and processing status
UploadQueue-->>User: progress and status
alt upload fails
UploadQueue-->>User: error reason
User->>UploadQueue: retry(uploadKey)
UploadQueue->>API: POST media/upload with X-Idempotency-Key
end
User->>ContentAPI: submit with assetIds
ContentAPI-->>User: content references staged assets
Sequence diagram for idempotent moment autosave and publishsequenceDiagram
participant User
participant MomentEditor
participant BrowserStorage
participant BlogAPI
User->>MomentEditor: edit title, content, or media
MomentEditor->>BrowserStorage: localStorage.setItem
MomentEditor->>BlogAPI: sendIdempotent(moments/post, draft)
BlogAPI-->>MomentEditor: saved draft
MomentEditor-->>User: autosave status
User->>MomentEditor: publish
MomentEditor->>BlogAPI: sendIdempotent(moments/post, publishKey)
BlogAPI-->>MomentEditor: published moment
MomentEditor-->>User: saved
Flow diagram for virtualized chat history renderingflowchart TD
HistoryAPI[chat/history] --> Messages[Sorted message list]
Messages --> Virtualizer[useVirtualizer]
Virtualizer --> VisibleRows[Visible and overscan rows]
VisibleRows --> Measure[measureMessageElement]
Measure --> Virtualizer
Older[Load older] --> HistoryAPI
NewMessage[Incoming message] --> Stick[Keep latest visible]
Stick --> VisibleRows
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
把博客上传从一次性 multipart 提交升级为可观察、可重试的资产流程,同时降低长聊天记录的渲染成本,并把性能约束纳入 CI。
主要改动
@tanstack/react-virtual做可变高度虚拟化,保留向上加载锚点与实时消息自动贴底。后端依赖
验证
Summary by Sourcery
Modernize blog media handling with resilient managed uploads, make long chat histories efficient through virtualization, and enforce quality and performance checks in CI.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Tests: