Conversation
When updating a refundable deposit that already has a recorded refund date, the form was overwriting refundedAt with new Date() on every save. This silently replaced the real refund timestamp with the edit time. Now uses the existing expense.refundedAt when available, only falling back to new Date() for newly received refunds.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
This branch had an error being deployed
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.
Daily Product Improvement
📝 TLDR
Preserve the original
refundedAttimestamp when editing an existing refundable expense instead of overwriting it with the current time on every save.📝 Description
When a user records that a refund was received on a deposit expense, the
refundedAtfield is set to the timestamp of that moment. However, when editing the same expense later — even just to fix the description or amount — re-submitting the form with "Refund received" still toggled on silently overwroterefundedAtwithnew Date()(the time of the edit), discarding the real refund date.This is a data integrity bug: the original refund date is lost without any warning to the user.
This Change
expense-form.tsx, therefundedAtcomputation now usesexpense?.refundedAt ?? new Date()so the original timestamp is preserved when it exists🧪 Testing
🧪 How to test as a user
refundedAttimestamp in the database or via the API.refundedAtstill matches the original timestamp — it should not update to the edit time.🎨 Style and code quality
biome checkon all new and updated files — no errors📦 Dependencies
Recommendations Reviewed
Area:
src/components/budget/expense-form.tsxIssue: When editing an existing expense with a recorded refund date,
refundedAtwas overwritten withnew Date()on every save.Recommendation: Use
expense?.refundedAt ?? new Date()to preserve the original timestamp.Type: Backend cleanup / data integrity
Priority: High
Effort: Small
Area:
src/app/(authenicated)/budget/page.tsx,vendors/page.tsxIssue: API errors are silently swallowed and the user is redirected to
/with no explanation, bypassing the route error boundary.Recommendation: Let errors propagate so
error.tsxcatches them and shows a "Try again" CTA in context.Type: Product flow / UX
Priority: High
Effort: Medium
Area:
src/components/guest-list/guests-view.tsxIssue:
filteredHouseholdsis stored in local state and re-synced viauseEffect. When background query invalidations fire, the effect resets the active search filter, clearing text the user typed.Recommendation: Replace duplicated local state with a
useMemo-derived value so the filter is never destroyed by a refetch.Type: Frontend cleanup / UX
Priority: Medium
Effort: Medium
Area:
src/components/vendor/vendor-detail-panel.tsxIssue: The scratchpad textarea has no unsaved-changes guard. Edits are silently discarded when the panel is closed without clicking "Save Scratchpad."
Recommendation: Add an
isDirtycheck and a discard-confirmation dialog on panel close, matching the pattern already used in the guest detail drawer.Type: UX
Priority: Medium
Effort: Medium
Area:
src/components/vendor/vendor-detail-panel.tsx(lines 159–163)Issue:
isSubmittingandisUploadingare always set totrue/falsetogether — they are effectively one boolean but stored as two.Recommendation: Collapse into a single
isBusystate variable.Type: Frontend cleanup
Priority: Low
Effort: Small
Area:
src/components/budget/index.tsx,src/components/vendor/index.tsxIssue: No
staleTimeis set on queries that receiveinitialDatafrom the server, causing an immediate background refetch on every mount.Recommendation: Add
staleTime: 30_000(matching the pattern used in events and checklist) so the server-rendered data is respected for 30 s.Type: Frontend cleanup
Priority: Low
Effort: Small
Selected Improvement
Preserve original
refundedAttimestamp when editing a budget expense —src/components/budget/expense-form.tsxline 93.Why This Was Selected
This is the highest-severity, lowest-effort fix available today that has no open PR. It is a silent data-corruption bug: every time a user edits a refundable deposit that has already been marked as refunded, the real refund date is overwritten with the current wall-clock time. The fix is a single expression change, is easy to verify, and carries zero risk of regressions in unrelated areas.
Changes Made
expense-form.tsxline 93: changednew Date()toexpense?.refundedAt ?? new Date()inside therefundedAtassignment so existing refund timestamps are preserved on edit.Files Changed
src/components/budget/expense-form.tsxVerification
baseUrldeprecation warning is unrelated to this change)expenseis only defined whenmode === 'edit'(line 32); inmode === 'create'modeexpenseisundefined, soexpense?.refundedAtevaluates toundefinedand the nullish coalescing operator correctly falls through tonew Date()— no regression on create.Future Recommendations
Silent redirect on API error (budget, vendors)
Guest list search filter reset on data refresh
Vendor scratchpad unsaved-changes guard
GitHub Issues Created or Proposed
No GitHub issues created. The silent-redirect issue (budget/vendors) is worth tracking but is already clearly described here; a future daily run can open an issue if it remains unaddressed.
Generated by Claude Code