feat: add list validity check

This commit is contained in:
Rohit Rajan
2025-11-06 23:17:26 +05:30
parent 8489f95ff0
commit 5e05b08434

View File

@@ -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({});