Fix bugs #37, #39, #40: form submission, discipline select, duplicate uploads - #20
Open
garymeyerca wants to merge 2 commits into
Open
Fix bugs #37, #39, #40: form submission, discipline select, duplicate uploads#20garymeyerca wants to merge 2 commits into
garymeyerca wants to merge 2 commits into
Conversation
Remove dangling `<div` tags (missing closing `>`) in new.html.erb, index.html.erb, and show.html.erb. The unclosed tag caused browser HTML error recovery to swallow the form element, preventing form submission entirely — the core "Log a Jump" action silently did nothing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three root causes fixed: 1. JS: filesSelected() doubled files — it passed this.inputTarget.files to addFiles(), which also read from this.inputTarget.files, adding every file twice. Fix: snapshot files and clear input before calling addFiles(). 2. JS: Turbo cache caused stale file inputs — when Turbo caches a page and restores it, the Stimulus controller reconnected with leftover state. Fix: reset file input and previews in connect()/disconnect(). 3. Server: has_many_attached appends on update — passing photos through jump_params on update caused Active Storage to append duplicates. Fix: separate photo attachment from the update call, only attaching explicitly new files. Also added data-turbo-submits-with to the submit button to prevent double form submission during Turbo navigation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Three user-reported bugs fixed. See commit messages for details.