diff --git a/src/components/browser/BrowserWindow.tsx b/src/components/browser/BrowserWindow.tsx index 98642f8c5..deff7f0f2 100644 --- a/src/components/browser/BrowserWindow.tsx +++ b/src/components/browser/BrowserWindow.tsx @@ -1174,16 +1174,31 @@ export const BrowserWindow = () => { undefined, false ); + + if (pendingNotification) { + notify(pendingNotification.type, pendingNotification.message); + setPendingNotification(null); + } + } else { + console.warn(`Failed to extract any fields from list selector: ${listSelector}`); + + setListSelector(null); + setFields({}); + setCachedListSelector(null); + setCachedChildSelectors([]); + setCurrentListId(null); + setInitialAutoFieldIds(new Set()); + setPendingNotification(null); + + notify( + "error", + "The list you have selected is not valid. Please reselect it." + ); } } catch (error) { console.error("Error during child selector caching:", error); } finally { setIsCachingChildSelectors(false); - - if (pendingNotification) { - notify(pendingNotification.type, pendingNotification.message); - setPendingNotification(null); - } } }, 100); } else { @@ -1710,16 +1725,17 @@ export const BrowserWindow = () => { let cleanedSelector = highlighterData.selector; setListSelector(cleanedSelector); - notify( - `info`, - t( + setPendingNotification({ + type: `info`, + message: t( "browser_window.attribute_modal.notifications.list_select_success", { count: highlighterData.groupInfo.groupSize, } ) || - `Selected group with ${highlighterData.groupInfo.groupSize} similar elements` - ); + `Selected group with ${highlighterData.groupInfo.groupSize} similar elements`, + count: highlighterData.groupInfo.groupSize, + }); setCurrentListId(Date.now()); setFields({});