feat: prevent empty messages and optimistic posting - #4
Merged
Conversation
Co-authored-by: benfoxall <51385+benfoxall@users.noreply.github.com>
Co-authored-by: benfoxall <51385+benfoxall@users.noreply.github.com>
Co-authored-by: benfoxall <51385+benfoxall@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
benfoxall
August 8, 2026 20:46
View session
benfoxall
approved these changes
Aug 9, 2026
benfoxall
marked this pull request as ready for review
August 9, 2026 05:26
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.
Fixes two UX issues with message posting:
Prevent blank messages — trims the message text and returns early if it's empty or whitespace-only, so accidental blank posts can't happen.
Optimistic posting — the note is saved to the DB immediately (with placeholder
lat: 0, lon: 0) so it appears in the list right away and the form resets instantly. Geolocation then runs in the background and updates the record with real coordinates on success; on failure the note stays at0, 0.Map bounds fix — notes with
lat: 0, lon: 0(i.e. still awaiting geolocation) are filtered out ofnoteLocationsso the map doesn't try to fit the Gulf of Guinea into the viewport. Once real coordinates arrive the note appears on the map automatically.All 12 tests pass.