asdf
This commit is contained in:
@@ -85,6 +85,14 @@ const Applications = () => {
|
||||
};
|
||||
|
||||
const fetchPropertyDetails = async (propertyId) => {
|
||||
// Validate propertyId
|
||||
if (!propertyId || isNaN(parseInt(propertyId))) {
|
||||
console.error('Invalid property ID:', propertyId);
|
||||
toast.error('Invalid property ID');
|
||||
setSelectedPropertyDetails(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check cache first
|
||||
if (propertyCache[propertyId]) {
|
||||
setSelectedPropertyDetails(propertyCache[propertyId]);
|
||||
@@ -140,9 +148,17 @@ const Applications = () => {
|
||||
// Set the executing application and show the modal
|
||||
setExecutingApplication(application);
|
||||
|
||||
// Also fetch the property details if we don't have them
|
||||
if (!selectedPropertyDetails || selectedPropertyDetails.id !== application.property?.id) {
|
||||
await fetchPropertyDetails(application.property?.id || application.section?.propertyId);
|
||||
// Get the property ID from the application
|
||||
const propertyId = application.property?.id || application.section?.propertyId;
|
||||
|
||||
// Also fetch the property details if we don't have them and we have a valid property ID
|
||||
if (!selectedPropertyDetails || (propertyId && selectedPropertyDetails.id !== propertyId)) {
|
||||
if (propertyId) {
|
||||
await fetchPropertyDetails(propertyId);
|
||||
} else {
|
||||
console.warn('No property ID found for application:', application);
|
||||
toast.warning('No property associated with this application');
|
||||
}
|
||||
}
|
||||
|
||||
setShowExecutionModal(true);
|
||||
|
||||
Reference in New Issue
Block a user