Repository navigation
Conversation
The device form stored "Default refresh rate" straight from the input,
so it was saved as a string ("600"). normalizeRefreshSchedule only
accepts a number and returned null for the whole schedule, so the UI
showed the 300 s fallback, /api/display sent the 180 s fallback, and
time-range overrides were ignored too.
Parse the field as an integer in the form, like the time-range rates
already are, and let normalizeRefreshSchedule accept numeric strings so
rows saved by the old form work again.
Closes usetrmnl#89
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #89.
Problem
The "Default refresh rate" field on the device page is saved as a string (
"default_refresh_rate": "600"), because the generichandleInputChangestorese.target.valueas is.normalizeRefreshScheduleonly accepts a number, so it returnsnullfor the whole schedule:/api/displaysends the 180 s fallback,Time-range rates are not affected because
handleNestedInputChangealready runsNumber.parseInt.Fix
client-page.tsx): parserefresh_schedule.default_refresh_ratewithNumber.parseInt, like the time-range rates.lib/device/defaults.ts):normalizeRefreshScheduleaccepts numeric strings ("600") for the default and time-range rates, so rows already saved by the old form work again without a migration. Anything else still givesnullfor the default, and invalid time ranges are dropped as before.Tests
Adds
lib/device/defaults.test.tsfor numeric schedules, numeric strings, JSON string columns, invalid defaults and invalid time ranges. The two numeric-string cases fail without the fix.pnpm lint,pnpm typecheckandpnpm testpass.🤖 Generated with Claude Code