Skip to content

fix: make the Refresh button call Get-StockExchangeData - #3

Open
knightmare2600 wants to merge 1 commit into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/fix-refresh-button
Open

knightmare2600 wants to merge 1 commit into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/fix-refresh-button

Conversation

@knightmare2600

@knightmare2600 knightmare2600 commented Oct 9, 2026 •

Copy link
Copy Markdown

Summary

The Refresh button never refreshed anything. It now calls Get-StockExchangeData -ForceRefresh.

The bug

  • The click handler did if (Test-Path $scraperPath) { & $scraperPath -ForceRefresh }, but $scraperPath is never defined anywhere in the module. It looks like a leftover from before the module restructure, when the scraper was a standalone script.
  • Test-Path $null does not throw. It writes a non-terminating "Value cannot be null" error to the console and returns nothing, so the if block was skipped:
    • nothing was refreshed;
    • the status bar stayed on "Refreshing exchange data...";
    • the catch block never ran.

The fix

  • Call the module's own Get-StockExchangeData -ForceRefresh directly.
  • As before, it rewrites the exchange-data cache and the status bar reports the count. The exchange grid is not rebuilt, which is unchanged behaviour.

Known, pre-existing

  • The refresh still attempts the Wikipedia scrape on the UI thread (15 s timeout), so the window can pause briefly. This PR does not change that.

Checks

  • Parses cleanly; manifest validates.
  • Lint: the Lint workflow already fails on main before this change — PSScriptAnalyzer reports 120 Warning-level findings there (e.g. run 36486962685). This PR adds no new findings (compared by rule, file and message against main), so a red Lint check here is the pre-existing state.
  • Not run: the WPF dashboard itself (Windows-only); checks were run on Linux with PowerShell 7.6.3.
  • CHANGELOG: this PR adds its own entry under [Unreleased]. The PRs in this series are independent where possible, so whichever merges second will have a trivial conflict in that section — keep both entries.

This is one of a series of small PRs (fixes and features kept separate so you can pick and choose): #2 countdown hours · #3 Refresh button · #4 map preferences · #5 Nasdaq Copenhagen · #6 OMXC25 · #7 FX DKK/SEK · #8 København clock · #9 FTSE 100 · #10 ETF labels.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant