fix(sessions): disable message send when offline#2121
fix(sessions): disable message send when offline#2121pauldambra wants to merge 2 commits intomainfrom
Conversation
When the connectivity store reports offline, the session view's PromptInput now disables submit. Previously, pressing Enter offline cleared the editor without actually sending the message — losing the user's text. The task-creation composer already gated submit on `isOnline`; this brings the follow-up-message composer in line. Refs #758 Generated-By: PostHog Code Task-Id: a29b652e-dc35-43cb-b560-f91d52f56732
paul-reviewerok so a 3-line change to stop the message disappearing into the void when we're offline. stamp 🚢 — but a few thoughts:
stamp anyway 🚢 |
xp-reviewerA small, focused fix — the intent is clear from the diff alone, which is a good sign. The change reuses the existing Rule 2 (expresses every idea): const cannotSend = handoffInProgress || !isOnline
// ...
submitDisabledExternal={cannotSend}Not strictly necessary at two clauses, but if a third reason appears, that's the moment to do it. ThreeStrikesAndYouRefactor. Rule 3 (OnceAndOnlyOnce): This is now the second composer that checks Rule 1 (passes all tests): No test was added. For a 3-line guard this is borderline YAGNI vs. genuine coverage, but the connectivity-gated send is exactly the kind of subtle behavior that disappears in a refactor without anyone noticing — there is no failing test if a future change drops YAGNI win: You did not introduce a new "offline-aware composer" abstraction, a context provider, or a higher-order component. You added one line that uses infrastructure that already exists. That is the correct shape for this change. Ship it. |
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sessions/components/SessionView.tsx:623-625
When the user has already typed a message and then goes offline, `submitBlocked` becomes true via `submitDisabledExternal`, so the submit button tooltip falls back to `"Enter a message"` — even though text is present. `submitTooltipOverride` exists precisely to override this default; passing it when offline makes the disabled state self-explanatory.
```suggestion
submitDisabledExternal={
handoffInProgress || !isOnline
}
submitTooltipOverride={
!isOnline ? "No internet connection" : undefined
}
```
Reviews (1): Last reviewed commit: "fix(sessions): disable message send when..." | Re-trigger Greptile |
Without `submitTooltipOverride`, the disabled send button tooltip falls back to "Enter a message" even when text is present, hiding the real reason. Override it to "No internet connection" while offline so the disabled state is self-explanatory. Generated-By: PostHog Code Task-Id: a29b652e-dc35-43cb-b560-f91d52f56732
|
Reviews (2): Last reviewed commit: "fix(sessions): tooltip explains why send..." | Re-trigger Greptile |
Summary
When the connectivity store reports offline, the session view's
PromptInputnow disables submit. Previously, pressing Enter offline cleared the editor without sending anything — losing the user's text.The task-creation composer (
TaskInput) already gated submit onisOnline; this brings the follow-up-message composer inSessionViewin line by adding!isOnlinetosubmitDisabledExternal. Reuses the existing disable mechanism, so:useTiptapEditorviasubmitDisabledRef)Refs SupportHog ticket #758.
Test plan
TaskInput(new task composer) behavior is unchanged.Created with PostHog Code