Skip to content

fix: eliminate send-to-screen delay by adding user message to items immediately#3430

Merged
esengine merged 3 commits into
esengine:main-v2from
CVEngineer66:fix/send-to-screen-delay
Jun 7, 2026
Merged

fix: eliminate send-to-screen delay by adding user message to items immediately#3430
esengine merged 3 commits into
esengine:main-v2from
CVEngineer66:fix/send-to-screen-delay

Conversation

@CVEngineer66

Copy link
Copy Markdown
Contributor

Problem

After clicking Send / pressing Enter, the user's own message takes multiple seconds (sometimes 10-60s) to appear on screen. Every single message is affected regardless of network speed.

Fixes #3296.

Root cause

dispatch({type:"user"}) only set pendingUser, leaving the actual items[] append to flushPendingUser — which waited for a backend event after turn_started. The Go backend initialization + Wails bridge round trip caused the delay.

Fix

The reducer now appends to items[] directly (so the message renders instantly) while keeping pendingUser set (so cancel() still works). flushPendingUser detects the message is already rendered and only clears the flag.

Testing

  • cd desktop/frontend && pnpm build — ✅
  • gofmt -l . — ✅ clean

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 7, 2026
…mmediately

Previously, dispatch({type:"user"}) only set pendingUser, leaving the
actual items[] append to flushPendingUser — which waited for a backend
event after turn_started. The Go backend init + Wails bridge round trip
caused a multi-second delay before the user saw their own message.

Now the reducer appends to items[] directly while keeping pendingUser
set, so cancel() still works. flushPendingUser detects the message is
already rendered and only clears the flag.

Fixes esengine#3296.
@CVEngineer66 CVEngineer66 force-pushed the fix/send-to-screen-delay branch from 12c6897 to a69dfb0 Compare June 7, 2026 08:22
wufengfan added 2 commits June 7, 2026 16:28
Same root cause as PR esengine#3418 — the .onboarding__skip:disabled block was
missing its closing '}', causing check-css-syntax.mjs to fail.
@esengine esengine closed this Jun 7, 2026
@esengine esengine reopened this Jun 7, 2026
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 7, 2026
@esengine esengine merged commit 541de75 into esengine:main-v2 Jun 7, 2026
19 checks passed
@CVEngineer66 CVEngineer66 deleted the fix/send-to-screen-delay branch June 9, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 我输入内容发送以后,要等一段时间才发送出去显示在屏幕上,严重影响体验

2 participants