Skip to content

fix(actions): show '--' placeholder on fuel toggle when no telemetry available (#227)#231

Merged
niklam merged 1 commit into
masterfrom
fix/227-fuel-toggle-default-display
Mar 29, 2026
Merged

fix(actions): show '--' placeholder on fuel toggle when no telemetry available (#227)#231
niklam merged 1 commit into
masterfrom
fix/227-fuel-toggle-default-display

Conversation

@niklam
Copy link
Copy Markdown
Owner

@niklam niklam commented Mar 29, 2026

Related Issue

Fixes #227

What changed?

  • getFuelAmount() returns undefined instead of 0 when no telemetry is available, distinguishing "no data" from "zero fuel requested"
  • fuelFillDynamicIcon() displays "--" when fuelAmount is undefined, only calling formatFuelFillAmount() with real telemetry data
  • buildStateKey() uses "none" for undefined fuel amount so the icon updates correctly when telemetry connects with an actual 0 value

How to test

  1. Add a Fuel Service action in toggle-fuel-fill mode
  2. Before connecting to iRacing, verify the icon shows "--" (not "+0 g")
  3. Connect to iRacing and verify the icon updates to show the actual fuel amount
  4. Run pnpm test --filter @iracedeck/actions — all 76 tests pass

Checklist

  • Linked to an approved issue
  • New code has unit tests
  • Changes registered in all applicable plugins (Stream Deck, Mirabox)
  • No unrelated changes included

Summary by CodeRabbit

Bug Fixes

  • Fuel display now shows "--" when fuel telemetry data is unavailable, instead of defaulting to zero liters, providing clearer indication of missing data.

…available (#227)

getFuelAmount() now returns undefined instead of 0 when telemetry is
absent, allowing the toggle-fuel-fill icon to display '--' instead of
the misleading '+0 g'. The state key uses 'none' for undefined fuel
amount so the display updates correctly when telemetry connects.
@github-actions github-actions Bot added the type: bug Bug fix label Mar 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70179d34-90bd-4289-b58b-cfe146a02cf7

📥 Commits

Reviewing files that changed from the base of the PR and between ea249ee and 9e97536.

📒 Files selected for processing (2)
  • packages/actions/src/actions/fuel-service.test.ts
  • packages/actions/src/actions/fuel-service.ts

📝 Walkthrough

Walkthrough

The PR updates the Fuel Service fuel-fill icon to display "--" instead of "+0" when telemetry data is unavailable. The getFuelAmount function now returns number | undefined instead of defaulting to 0, and the state caching uses a sentinel "none" string when fuel amount is undefined. Tests are updated to verify the new behavior.

Changes

Cohort / File(s) Summary
Core Fuel Service Logic
packages/actions/src/actions/fuel-service.ts
Updated getFuelAmount return type to number | undefined; changed null/missing PitSvFuel handling to return undefined instead of 0; modified icon rendering to display "--" placeholder when fuel amount is undefined; switched state caching sentinel from 0 to "none" for toggle-fuel-fill mode.
Fuel Service Tests
packages/actions/src/actions/fuel-service.test.ts
Updated getFuelAmount expectations to return undefined for missing/null telemetry; extended generateFuelServiceSvg test coverage for toggle-fuel-fill mode to verify "--" placeholder appears when telemetry is absent and when fuelAmount is undefined.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: bug

Poem

🐰 A fuel gauge, once false with its zero,
Now wisely shows dashes, a telemetry hero!
When data's away, no more "+0" delight—
Just "--" on the screen, honest and right! 🔋✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the Fuel Service Toggle to show '--' placeholder instead of '+0 g' when telemetry is unavailable.
Description check ✅ Passed The description covers all required template sections with specific implementation details, testing steps, and a completed checklist verifying linked issue, unit tests, plugin changes, and no unrelated changes.
Linked Issues check ✅ Passed All coding objectives from issue #227 are met: getFuelAmount returns undefined instead of 0 [#227], fuelFillDynamicIcon displays '--' for undefined telemetry [#227], buildStateKey uses 'none' sentinel for state changes [#227], and fuel-service.test.ts tests added [#227].
Out of Scope Changes check ✅ Passed All changes are directly scoped to fuel-service.ts and fuel-service.test.ts addressing the placeholder display issue and state handling; no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/227-fuel-toggle-default-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@niklam niklam merged commit 5c009b1 into master Mar 29, 2026
6 checks passed
@niklam niklam deleted the fix/227-fuel-toggle-default-display branch March 29, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change Fuel Service Toggle Fuel Level default view from "+0 g" to "--"

1 participant