Skip to content

Commit 7d2c184

Browse files
authored
Merge pull request #878 from getmaxun/caplist-fail
fix: broken capture list failure mechanism
2 parents 288f7fc + 5e05b08 commit 7d2c184

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/components/browser/BrowserWindow.tsx

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,16 +1164,31 @@ export const BrowserWindow = () => {
11641164
undefined,
11651165
false
11661166
);
1167+
1168+
if (pendingNotification) {
1169+
notify(pendingNotification.type, pendingNotification.message);
1170+
setPendingNotification(null);
1171+
}
1172+
} else {
1173+
console.warn(`Failed to extract any fields from list selector: ${listSelector}`);
1174+
1175+
setListSelector(null);
1176+
setFields({});
1177+
setCachedListSelector(null);
1178+
setCachedChildSelectors([]);
1179+
setCurrentListId(null);
1180+
setInitialAutoFieldIds(new Set());
1181+
setPendingNotification(null);
1182+
1183+
notify(
1184+
"error",
1185+
"The list you have selected is not valid. Please reselect it."
1186+
);
11671187
}
11681188
} catch (error) {
11691189
console.error("Error during child selector caching:", error);
11701190
} finally {
11711191
setIsCachingChildSelectors(false);
1172-
1173-
if (pendingNotification) {
1174-
notify(pendingNotification.type, pendingNotification.message);
1175-
setPendingNotification(null);
1176-
}
11771192
}
11781193
}, 100);
11791194
} else {
@@ -1665,16 +1680,17 @@ export const BrowserWindow = () => {
16651680
let cleanedSelector = highlighterData.selector;
16661681

16671682
setListSelector(cleanedSelector);
1668-
notify(
1669-
`info`,
1670-
t(
1683+
setPendingNotification({
1684+
type: `info`,
1685+
message: t(
16711686
"browser_window.attribute_modal.notifications.list_select_success",
16721687
{
16731688
count: highlighterData.groupInfo.groupSize,
16741689
}
16751690
) ||
1676-
`Selected group with ${highlighterData.groupInfo.groupSize} similar elements`
1677-
);
1691+
`Selected group with ${highlighterData.groupInfo.groupSize} similar elements`,
1692+
count: highlighterData.groupInfo.groupSize,
1693+
});
16781694
setCurrentListId(Date.now());
16791695
setFields({});
16801696

0 commit comments

Comments
 (0)