You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-save tile edits in edit dashboard tile modal #1668
Often times it can be hard to remember you need to save the tile you're editing in the editor modal before closing - or else your changes are lost. We should experiment with just auto-saving the change on exit (but perserving cancel to still discard edits). We should toast on exit to make sure users understand we are now auto-saving queries. We can still keep the save button as-is for familiarity.
Need to update EditTileModal in packages/app/src/DBDashboardPage.tsx
Implementing Auto-Save for Edit Dashboard Tile Modal
Tasks
Read project documentation and understand codebase patterns
Read and analyze current EditTileModal implementation
Implement auto-save on modal close
Add toast notification for auto-save
Ensure cancel button still discards changes
Test changes if possible
Commit and push changes
Provide PR creation link
Implementation Details
I've successfully implemented the auto-save functionality with the following changes in DBDashboardPage.tsx:
Changes made:
Added useRef import for tracking the submit function
Modified EditTileModal to:
Track a submitRef that gets the latest save function from EditTimeChartForm
Added a handleClose function that distinguishes between cancelling and closing
When closing (X button or backdrop click): Triggers auto-save via submitRef.current() and shows a toast notification
When cancelling (Cancel button): Discards changes without saving
Shows green toast notification "Tile changes auto-saved" when auto-saving
User experience:
Save button: Still works as before for manual saving
Cancel button: Explicitly discards changes (no auto-save)
Close button/backdrop: Auto-saves changes and shows toast notification
The save button remains for familiarity as requested
Summary
The implementation addresses the issue where users often forget to save before closing the modal. Now, closing the modal (via X button or clicking outside) will automatically save the changes with a toast notification. Users can still explicitly discard changes using the Cancel button, and the Save button is preserved for familiarity.
@claude you need to save by using the handleSubmit(handleSave) call in the save button in the file packages/app/src/components/DBEditTimeChartForm.tsx the current ref approach does not work as it won't actually save anything.
Read current implementation in DBDashboardPage.tsx
Read DBEditTimeChartForm.tsx to understand the save mechanism
Implement correct auto-save using handleSubmit(handleSave)
Commit and push changes
Provide PR creation link
Summary
Fixed the auto-save implementation to properly use handleSubmit(handleSave) from the form's save button. The previous ref-based approach didn't work because it bypassed React Hook Form's validation and save processing logic.
Implementation Details
Changes made:
DBEditTimeChartForm.tsx (line 746-750):
Modified the submitRef to expose handleSubmit(handleSave) instead of just onSubmit
This ensures the proper form validation and save process is triggered when called externally
DBDashboardPage.tsx:
Added useRef import
Modified EditTileModal to:
Create a submitRef to receive the save function from the form
Track shouldCancel state to distinguish between cancel and close actions
handleClose: Triggers auto-save via submitRef.current() and shows green toast notification "Tile changes auto-saved"
handleCancel: Sets the cancel flag to skip auto-save
Modal's onClose prop now calls handleClose (triggered by X button and backdrop clicks)
Created autoSaveRef in EditTileModal component (line 522)
Added shouldCancel state to distinguish between cancel and close actions (line 523)
Implemented handleClose: Auto-saves via autoSaveRef.current() and shows green toast notification "Tile changes auto-saved" (lines 525-535)
Implemented handleCancel: Sets cancel flag to skip auto-save (lines 537-540)
Modal's onClose prop now calls handleClose (triggered by X button and backdrop clicks) (line 545)
Form's onClose prop now calls handleCancel (triggered by Cancel button) (line 567)
User Experience:
Save button: Works as before for manual saving
Cancel button: Explicitly discards changes without auto-saving
Close button (X) / backdrop click: Auto-saves changes and shows toast notification
Save button remains for familiarity as requested
Note: I was unable to run yarn lint directly as it requires approval in this environment. However, I reviewed the code carefully and fixed the dependency order issue in the useEffect hook that would have caused a linting error.
Activity
MikeShi42 commentedon Jan 28, 2026
@claude can you help implement this adjustment to close behavior?
claude commentedon Jan 28, 2026
Claude finished @MikeShi42's task in 2m 14s —— View job •
claude/issue-1668-20260128-0723• Create PR ➔Implementing Auto-Save for Edit Dashboard Tile Modal
Tasks
EditTileModalimplementationImplementation Details
I've successfully implemented the auto-save functionality with the following changes in
DBDashboardPage.tsx:Changes made:
useRefimport for tracking the submit functionEditTileModalto:submitRefthat gets the latest save function fromEditTimeChartFormhandleClosefunction that distinguishes between cancelling and closingsubmitRef.current()and shows a toast notificationUser experience:
Summary
The implementation addresses the issue where users often forget to save before closing the modal. Now, closing the modal (via X button or clicking outside) will automatically save the changes with a toast notification. Users can still explicitly discard changes using the Cancel button, and the Save button is preserved for familiarity.
Branch: claude/issue-1668-20260128-0723 |
feat: Auto-save tile edits in edit dashboard tile modal
MikeShi42 commentedon Jan 28, 2026
@claude you need to save by using the
handleSubmit(handleSave)call in the save button in the filepackages/app/src/components/DBEditTimeChartForm.tsxthe current ref approach does not work as it won't actually save anything.claude commentedon Jan 28, 2026
Claude finished @MikeShi42's task in 1m 49s —— View job •
claude/issue-1668-20260128-0751• Create PR ➔Fixed Auto-Save Implementation
Tasks
DBDashboardPage.tsxDBEditTimeChartForm.tsxto understand the save mechanismhandleSubmit(handleSave)Summary
Fixed the auto-save implementation to properly use
handleSubmit(handleSave)from the form's save button. The previous ref-based approach didn't work because it bypassed React Hook Form's validation and save processing logic.Implementation Details
Changes made:
DBEditTimeChartForm.tsx (line 746-750):
submitRefto exposehandleSubmit(handleSave)instead of justonSubmitDBDashboardPage.tsx:
useRefimportEditTileModalto:submitRefto receive the save function from the formshouldCancelstate to distinguish between cancel and close actionshandleClose: Triggers auto-save viasubmitRef.current()and shows green toast notification "Tile changes auto-saved"handleCancel: Sets the cancel flag to skip auto-saveonCloseprop now callshandleClose(triggered by X button and backdrop clicks)onCloseprop (Cancel button) now callshandleCancel(to skip auto-save)User experience:
--- • Branch: claude/issue-1668-20260128-0751
MikeShi42 commentedon Jan 28, 2026
@claude do not modify
submitRef, please pass another ref if needed. Additionally, you need to runyarn lintto validate changes before committing.claude commentedon Jan 28, 2026
Claude finished @MikeShi42's task in 2m 34s —— View job •
claude/issue-1668-20260128-0755• Create PR ➔Fixed Auto-Save Implementation
Tasks
yarn lintto validate changesImplementation Summary
Fixed the auto-save implementation by creating a separate
autoSaveRefprop instead of modifying the existingsubmitRef.Changes Made:
DBEditTimeChartForm.tsx (packages/app/src/components/DBEditTimeChartForm.tsx):
autoSaveRefas a new optional prop (line 532)handleSavedefinition before theuseEffecthooks to fix dependency order (line 747)useEffectto assignhandleSubmit(handleSave)toautoSaveRef(lines 754-758)submitRefprop remains completely untouchedDBDashboardPage.tsx (packages/app/src/DBDashboardPage.tsx):
useRefimport (line 7)autoSaveRefinEditTileModalcomponent (line 522)shouldCancelstate to distinguish between cancel and close actions (line 523)handleClose: Auto-saves viaautoSaveRef.current()and shows green toast notification "Tile changes auto-saved" (lines 525-535)handleCancel: Sets cancel flag to skip auto-save (lines 537-540)onCloseprop now callshandleClose(triggered by X button and backdrop clicks) (line 545)onCloseprop now callshandleCancel(triggered by Cancel button) (line 567)User Experience:
Note: I was unable to run
yarn lintdirectly as it requires approval in this environment. However, I reviewed the code carefully and fixed the dependency order issue in the useEffect hook that would have caused a linting error.• Branch: claude/issue-1668-20260128-0755
pulpdrew commentedon Jun 4, 2026
Closing, as we've added a confirmation dialog to prevent accidentally discarding tile changes, and prefer that over auto-saving tile edits.