refactor(comment): drop the dead comment-autosave machinery - #169
Merged
Conversation
The UI has long saved comments only via the explicit save button (or Enter), but the composable still shipped the debounced input handlers behind the old autosave (createCommentInputHandler, the unused useMultiAppointmentResponse, the saved-indicator timers). Remove them and rename autoSaveComment to saveComment so nothing invites wiring typing back to the network. No behavior change.
Factor the shared transport (URL build, POST, non-2xx check) out of submitResponse and saveComment into one postRespond helper — the same block had already drifted into four copies in this file's history. saveComment now reports success via its return value instead of the errorComment ref, which no template ever rendered; with the last indicator timer gone, reset() and the unmount hook in ResponseEditor go too. The destructure alias follows the submitResponseApi convention used elsewhere.
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.
What
An audit for leftover comment autosave-on-keystroke behavior (paired with luflow/attendance-flutter#82, which fixes the real occurrence in the mobile app) confirmed the web UI already saves comments only via the explicit save button (or Enter) everywhere — own response comment (
ResponseEditor, used on the detail card, list card and dashboard widget) and the check-in comment (CheckinUserItem). ButuseAppointmentResponse.jsstill shipped the old autosave machinery with no callers left. This removes it so nothing invites wiring typing back to the network:createCommentInputHandler,useMultiAppointmentResponse.onCommentInput) and the entire unuseduseMultiAppointmentResponsecomposablecommentSaved, the 500 ms delayed spinner) and thesilentflagautoSaveCommentis renamed tosaveCommentA follow-up review commit then cleans up what the removal exposed: the shared transport (URL build, POST, non-2xx check) of
submitResponseandsaveCommentis factored into onepostRespondhelper (the block had already drifted into four copies in this file's history), andsaveCommentreports success via its return value instead of theerrorCommentref, which no template ever rendered — with the last indicator timer gone,reset()and the unmount hook inResponseEditorgo too.No behavior change; all translation strings are kept, so no l10n impact.
Verification
./scripts/check.shpasses: eslint, stylelint, php-cs-fixer, psalm, PHPUnit, vite build, both l10n checks, OpenAPI spec check. The e2e specs already exercise the explicit save-button flow and are untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01BNpTw85wK6Qv64ZSuF9P3Z
Generated by Claude Code