Refactor Form Submission Logic and Improve File Handling
- Updated `FormController.php` to correct the file path concatenation for temporary file retrieval, enhancing clarity in file management. - Modified `FormSubmissionResource.php` to improve the filtering logic for file fields, ensuring only valid files are processed. - Streamlined the constructor in `StoreFormSubmissionJob.php` for better readability and consistency. - Enhanced file handling in `StoreFormSubmissionJob.php` by refining the logic for moving files from temporary to permanent storage, ensuring accurate file management. - Improved the `FormSubmissionFormatter.php` to handle file URLs more robustly with error handling for signed routes. - Updated `PartialSubmissionTest.php` to remove the hardcoded success message, improving test reliability. - Refactored `OpenFormField.vue` to simplify the disabled state logic for form fields, enhancing maintainability. - Adjusted `usePartialSubmission.js` to improve the synchronization mechanism during visibility changes, ensuring data integrity. These changes aim to enhance the overall functionality, maintainability, and reliability of the form submission process and file handling logic.
This commit is contained in:
@@ -41,7 +41,6 @@ export function usePartialSubmission(formConfig, formDataRef, pendingSubmissionS
|
||||
clearTimeout(syncTimeout)
|
||||
}
|
||||
|
||||
// Set a new timeout - increased to 2 seconds for less frequent syncing
|
||||
syncTimeout = setTimeout(() => {
|
||||
syncToServer()
|
||||
}, 2000) // 2 second debounce
|
||||
@@ -93,13 +92,13 @@ export function usePartialSubmission(formConfig, formDataRef, pendingSubmissionS
|
||||
const handleVisibilityChange = () => {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
// When tab becomes hidden, sync immediately
|
||||
syncImmediately()
|
||||
debouncedSync()
|
||||
}
|
||||
}
|
||||
|
||||
const handleBlur = () => {
|
||||
// When window loses focus, sync immediately
|
||||
syncImmediately()
|
||||
debouncedSync()
|
||||
}
|
||||
|
||||
const handleBeforeUnload = () => {
|
||||
|
||||
Reference in New Issue
Block a user