-
Notifications
You must be signed in to change notification settings - Fork 14
fix(sessions): preserve prompt when sending while offline #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
posthog
wants to merge
4
commits into
main
Choose a base branch
from
posthog-code/preserve-prompt-when-offline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+24
−10
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b83d9bb
fix(sessions): preserve prompt when sending while offline
932a584
fix(sessions): drop redundant offline toast and comments
fcbabb7
fix(sessions): surface existing connectivity toast on offline submit
8a5548d
chore: untrack accidentally committed local settings file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleBeforeSubmitsilently returnsfalsewhen offline, so the editor content is preserved (correct) but the user gets no indication of why their submit was ignored. The PR description and test plan explicitly state "a 'Can't send while offline' toast appears," but no such toast is fired here.The existing connectivity toast in
connectivityToast.tsis debounced by 5 s, so if the user goes offline and tries to send within that window, the submit silently no-ops with zero feedback. Atoast.error(…)call is needed inside theif (!isOnline)branch.Prompt To Fix With AI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
originally, is the general toast for connectivity shown after this prompt is submitted? so if this stays as is, we would not be showing anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct. The general connectivity toast from
connectivityToast.tsfires on theisOnlinestate transition (after a 5-second debounce), not in response to a submit attempt. So it would show up regardless of whether the user tried to submit or not.In the original (pre-PR) flow:
onBeforeSubmitpassed (no connectivity check),onSubmitfired, editor clearedsendPromptthrew asynchronouslyWith this PR, if the user goes offline and submits within that 5-second window,
handleBeforeSubmitreturnsfalsesilently — the debounced toast hasn't appeared yet and there's no submit-specific toast either, so they get zero feedback. After the 5s window the general toast is already visible, so the silent no-op is more tolerable, but it's still not great UX.Adding a
toast.error(...)in the!isOnlinebranch (as I originally suggested) would handle the window case and give immediate, action-specific feedback regardless of when the user goes offline.Tip: You can customize Greptile's behavior for this repo with
.greptile/rules.mdand.greptile/config.json.