From dbf4644d6a8fa86cd4a83c638abc8070510c8140 Mon Sep 17 00:00:00 2001 From: knightmare2600 Date: Fri, 9 Oct 2026 22:59:05 +0100 Subject: [PATCH] fix: make the Refresh button call Get-StockExchangeData The Refresh button handler tested and invoked $scraperPath, which is never defined - a leftover from before the module restructure, when the scraper was a standalone script. Test-Path $null writes a non-terminating "Value cannot be null" error to the console and returns nothing, so the if-block was skipped: nothing was refreshed and the status bar stayed on "Refreshing exchange data...". Call the module's own Get-StockExchangeData -ForceRefresh instead. As before, the refreshed data is written to the exchange-data cache and the status bar reports the count; the exchange grid itself is not rebuilt (unchanged behaviour). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++++ .../Public/New-StockExchangeCountdownDashboard.ps1 | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d10eca..3dd7ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to PSExchangeClock will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- The **Refresh** button did nothing: it called an undefined `$scraperPath` left over from before the module restructure. It now calls `Get-StockExchangeData -ForceRefresh` + ## [1.1.0] - 2026-09-28 ### Fixed diff --git a/PSExchangeClock/Public/New-StockExchangeCountdownDashboard.ps1 b/PSExchangeClock/Public/New-StockExchangeCountdownDashboard.ps1 index 8c48fcb..28cf6a0 100644 --- a/PSExchangeClock/Public/New-StockExchangeCountdownDashboard.ps1 +++ b/PSExchangeClock/Public/New-StockExchangeCountdownDashboard.ps1 @@ -4957,12 +4957,10 @@ public static class CredManager { $btnRefresh.Add_Click({ $txtStatus.Text = 'Refreshing exchange data...' try { - if (Test-Path $scraperPath) { - $refreshed = & $scraperPath -ForceRefresh - if ($refreshed) { - $txtStatus.Text = "Refreshed $($refreshed.Count) exchanges" - $txtLastUpdated.Text = "Last updated: $([DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))" - } + $refreshed = @(Get-StockExchangeData -ForceRefresh) + if ($refreshed.Count -gt 0) { + $txtStatus.Text = "Refreshed $($refreshed.Count) exchanges" + $txtLastUpdated.Text = "Last updated: $([DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))" } } catch {