refactor: remove redundant pulse_gauge calls and fix breadcrumb dedup (S1, S3)

- S1: drop pulse_gauge(True) from inside pagination while-loops in
  _fetch_sites_bg, _fetch_tree_children_bg, and _fetch_list_contents_bg;
  the gauge is already running from the call before the loop
- S3: remove the is_breadcrumb bypass on the early-return guard so
  clicking the already-active breadcrumb segment no longer fires a
  redundant network request

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Tranberg
2026-04-12 09:45:49 +02:00
parent d529568798
commit a55365259c

View File

@@ -1723,7 +1723,6 @@ class SharePointApp(wx.Frame):
all_sites.extend(data.get('value', []))
url = data.get('@odata.nextLink')
self.set_status(f"{self.get_txt('status_fetching_sites')} ({len(all_sites)}...)")
self.pulse_gauge(True)
else:
break
@@ -1789,7 +1788,6 @@ class SharePointApp(wx.Frame):
res_data = res.json()
all_children.extend(res_data.get('value', []))
url = res_data.get('@odata.nextLink')
self.pulse_gauge(True)
else:
break
@@ -1857,8 +1855,8 @@ class SharePointApp(wx.Frame):
def _navigate_to_item_data(self, data, tree_item=None, is_breadcrumb=False):
try:
# Race-condition beskyttelse: Hvis vi allerede er der, så stop (undtagen ved brødkrumme-klik)
if not is_breadcrumb and getattr(self, 'current_path', None) == data.get("path"):
# Race-condition beskyttelse: Hvis vi allerede er der, så stop
if getattr(self, 'current_path', None) == data.get("path"):
return
self.current_path = data["path"]
@@ -1941,8 +1939,7 @@ class SharePointApp(wx.Frame):
items_data.extend(chunk_data)
self.set_status(self.get_txt("status_loading_items").format(count=len(items_data)))
self.pulse_gauge(True)
# Chunked UI Update
if first_chunk:
wx.CallAfter(self._populate_list_ctrl, chunk_data, data, finalize=False)