Resolved: a few PR issues reported by coderabbitai

This commit is contained in:
Andrzej Martyna 2026-01-02 20:00:04 +01:00
parent f9018368ab
commit c75cb1acec
2 changed files with 21 additions and 14 deletions

View file

@ -123,10 +123,10 @@ public class TabsCache
_indexToElement[newIndex] = tabToAdd;
}
foreach (var tabtoRevive in tabsToRevive)
foreach (var tabToRevive in tabsToRevive)
{
Context.API.LogDebug(ClassName, $"TABS:Reset age of {TryName(tabtoRevive.Key)} as it appeared again");
_elementToInfo[tabtoRevive.Key].Age = 0;
Context.API.LogDebug(ClassName, $"TABS:Reset age of {TryName(tabToRevive.Key)} as it appeared again");
_elementToInfo[tabToRevive.Key].Age = 0;
}
Valid = true;

View file

@ -144,20 +144,27 @@ public class TabsReservationService : IDisposable
{
lock (_sync)
{
var currentTab = new BrowserTab
try
{
Title = tab.Current.Name,
BrowserName = trackingInfo.ProcessName,
Hwnd = trackingInfo.ProcessMainWindowHandle,
AutomationElement = tab
};
var currentTab = new BrowserTab
{
Title = tab.Current.Name,
BrowserName = trackingInfo.ProcessName,
Hwnd = trackingInfo.ProcessMainWindowHandle,
AutomationElement = tab
};
Context.API.LogDebug(ClassName, $"TABS:{RuntimeIdToKey(currentTab.AutomationElement)}:Registering {url} as tab: {currentTab.Title}");
_urlToBrowserTab[url] = currentTab;
_automationElementToUrl[currentTab.AutomationElement] = url;
Context.API.LogDebug(ClassName, $"TABS:{RuntimeIdToKey(currentTab.AutomationElement)}:Registering {url} as tab: {currentTab.Title}");
_urlToBrowserTab[url] = currentTab;
_automationElementToUrl[currentTab.AutomationElement] = url;
// required to take the tab into account by Flow Launcher main UI search window
Context.API.ReQuery();
// required to take the tab into account by Flow Launcher main UI search window
Context.API.ReQuery();
}
catch (ElementNotAvailableException)
{
Context.API.LogDebug(ClassName, $"TABS:Tab became unavailable before registration for {url}");
}
}
}