Skip to content

Precise risk-free entry, and autoload the latest saved run - #23

Merged
GusFurtado merged 1 commit into
mainfrom
rf-precision-and-autoload
Sep 12, 2026
Merged

GusFurtado merged 1 commit into
mainfrom
rf-precision-and-autoload

Conversation

@GusFurtado

Copy link
Copy Markdown
Collaborator

Context

Two more items from feedback. Stacked on #22.

Risk-free rate precision

  • Slider step tightened from 5 to 1 (81 positions instead of 17 — 5x finer dragging resolution).
  • The read-only value display is now an editable text field: type an exact rate directly rather than fighting the slider for it.
  • Locale bug avoided, not just noticed: I initially built this as <input type="number">, but a number input's displayed decimal separator follows the browser's locale (this session's browser renders commas) while its underlying .value is always period-formatted regardless — a recipe for someone typing what looks like a completely normal number in their own locale and having it silently fail to parse. Switched to plain text with inputmode="decimal", and comma is accepted as an alias for the decimal point when parsing.
  • Commits on change (blur/Enter), not input, and the render loop skips reformatting the field while it's focused, so typing doesn't fight itself and an unrelated render() firing mid-edit (e.g. the running overlay finishing) doesn't reset the cursor.
  • Real, previously-unnoticed bug fixed along the way: nothing ever moved the slider's thumb except its own drag handler — toggling units, typing an exact value, or loading a saved run with a different rate all left the thumb wherever it last was, out of sync with the actual state. renderRfControl() now syncs it on every render.

Autoload the latest saved run

init() now loads the most recent saved run automatically (saved runs are stored newest-first) if one exists, instead of always starting from the empty state. First-time visitors with nothing saved still get the get-started card.

Verification

Headless Chromium: typing an exact rate (including comma-decimal) moves both the display and the slider correctly and round-trips through the annualized toggle; a genuinely-focused mid-edit survives an unrelated render() unreformatted; invalid input reverts cleanly; loading two seeded saved runs on a fresh page auto-selects the newest one and fires a real analyze call with its tickers/period.

🤖 Generated with Claude Code

@GusFurtado
GusFurtado force-pushed the rail-cleanup-and-fixes branch from 40caf31 to 7eb210d Compare September 12, 2026 00:52
Risk-free rate:
- Slider step tightened from 5 to 1 (81 positions instead of 17 — 5x
  finer dragging resolution).
- The read-only value display is now an editable text field: type an
  exact rate directly rather than fighting the slider for it. Plain
  text, not <input type="number"> — a number input's displayed decimal
  separator follows the browser's locale (this session's browser shows
  commas), while its underlying value is always period-formatted
  regardless, which would silently break for anyone typing what looks
  like a perfectly normal number in their own locale. Comma is accepted
  as an alias for the decimal point when parsing instead.
- Commits on `change` (blur/Enter), not `input`, and the render loop
  skips reformatting the field while it's focused — typing a value
  doesn't fight itself, and an unrelated render() firing mid-edit (e.g.
  the running overlay finishing) doesn't reset the cursor either.
- Real, previously-unnoticed bug fixed along the way: nothing ever
  moved the *slider's* thumb except its own drag handler, so toggling
  units, typing an exact value, or loading a saved run with a different
  rate all left the thumb sitting wherever it last was, out of sync
  with the actual state. renderRfControl() now syncs it every render.

Saved runs:
- init() now loads the most recent saved run automatically (saved runs
  are stored newest-first) if one exists, instead of always starting
  from the empty state. First-time visitors with nothing saved still
  get the get-started card.

Verified with headless Chromium: typing an exact rate (including
comma-decimal) moves both the display and the slider correctly and
round-trips through the annualized toggle; a genuinely-focused mid-edit
survives an unrelated render() unreformatted; invalid input reverts
cleanly; loading two seeded saved runs on a fresh page auto-selects the
newest one and fires a real analyze call with its tickers/period.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@GusFurtado
GusFurtado force-pushed the rf-precision-and-autoload branch from bfd1583 to fb3a2b4 Compare September 12, 2026 00:53
@GusFurtado
GusFurtado changed the base branch from rail-cleanup-and-fixes to main September 12, 2026 00:53
@GusFurtado
GusFurtado merged commit 8e3496c into main Sep 12, 2026
5 checks passed
@GusFurtado
GusFurtado deleted the rf-precision-and-autoload branch September 12, 2026 01:02
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