fix: Enhanced EOI section reactivity for immediate UI updates after deletion
EOI State Management Improvements: - Added local reactive state (documentValidated, documentExists) to handle immediate UI updates - Enhanced hasGeneratedEOI computed property to use local state when validation completes - Fixed issue where EOI signatory status would persist after document deletion Real-time UI Responsiveness: - Component now immediately switches to Generate EOI UI when validation detects cleanup - No longer requires manual page refresh to see correct state - Proper state synchronization between validation results and UI display Validation Logic Enhancement: - validateDocument function now sets local reactive state immediately upon cleanup detection - Added comprehensive logging for debugging EOI state transitions - Handles edge cases where documensoID exists but document was deleted externally User Experience Improvements: - Automatic UI state transitions without user intervention - Clear visual feedback when orphaned data is cleaned up - Prevents phantom EOI states from confusing users The EOI section now correctly and immediately shows the generate UI when no valid document exists, eliminating the confusion from phantom signatory status displays.
This commit is contained in:
parent
8ec6c883ab
commit
24dcee57d9
|
|
@ -521,12 +521,29 @@ const isDeletingGenerated = ref(false);
|
|||
const signatureStatus = ref<any>(null);
|
||||
const isCheckingSignatures = ref(false);
|
||||
const isValidatingDocument = ref(false);
|
||||
const documentValidated = ref(false);
|
||||
const documentExists = ref(true); // Assume true initially
|
||||
|
||||
const hasGeneratedEOI = computed(() => {
|
||||
// Primary check: documensoID must exist for a generated EOI
|
||||
// If documensoID is null/undefined, then there's no generated EOI regardless of signature links
|
||||
|
||||
return !!(props.interest['documensoID']);
|
||||
const documensoID = props.interest['documensoID'];
|
||||
const hasDocumensoID = !!(documensoID && documensoID !== '' && documensoID !== 'null' && documensoID !== 'undefined');
|
||||
|
||||
// If validation has run and found the document doesn't exist, override with local state
|
||||
const finalResult = documentValidated.value ? (hasDocumensoID && documentExists.value) : hasDocumensoID;
|
||||
|
||||
console.log('[EOI Section] hasGeneratedEOI check:', {
|
||||
documensoID,
|
||||
hasDocumensoID,
|
||||
documentValidated: documentValidated.value,
|
||||
documentExists: documentExists.value,
|
||||
finalResult,
|
||||
interestId: props.interest.Id
|
||||
});
|
||||
|
||||
return finalResult;
|
||||
});
|
||||
|
||||
const eoiDocuments = computed(() => {
|
||||
|
|
@ -859,7 +876,11 @@ const deleteGeneratedEOI = async () => {
|
|||
};
|
||||
|
||||
const validateDocument = async () => {
|
||||
if (!props.interest['documensoID']) return;
|
||||
if (!props.interest['documensoID']) {
|
||||
documentValidated.value = true;
|
||||
documentExists.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
isValidatingDocument.value = true;
|
||||
|
||||
|
|
@ -882,6 +903,9 @@ const validateDocument = async () => {
|
|||
});
|
||||
|
||||
if (response.success) {
|
||||
documentValidated.value = true;
|
||||
documentExists.value = response.valid && !response.cleaned;
|
||||
|
||||
if (response.cleaned) {
|
||||
console.log('[EOI Section] Document validation cleaned up orphaned records');
|
||||
toast.info('Detected and cleaned up orphaned EOI data');
|
||||
|
|
@ -892,6 +916,8 @@ const validateDocument = async () => {
|
|||
}
|
||||
} catch (error: any) {
|
||||
console.error('[EOI Section] Failed to validate document:', error);
|
||||
documentValidated.value = true;
|
||||
documentExists.value = true; // Assume exists if validation fails
|
||||
// Don't show error to user - validation is a background process
|
||||
} finally {
|
||||
isValidatingDocument.value = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue