refactor(settings): enhance auto-update interval handling#382
Closed
periakteon wants to merge 1 commit into
Closed
refactor(settings): enhance auto-update interval handling#382periakteon wants to merge 1 commit into
periakteon wants to merge 1 commit into
Conversation
- Updated AutoUpdateIntervalMinutes type to allow custom values with a minimum of 0.5 minutes. - Introduced new constants for minimum and maximum custom interval limits. - Added utility functions for clamping intervals and formatting labels. - Refactored settings page to include a custom interval editor for user-defined intervals. - Improved user interface for selecting auto-update intervals, including preset options and custom input handling.
Owner
|
Hi, we put the 5-minute in place on purpose to not hammer them with requests. Thanks |
Author
However, 5 minutes is too long. I’m using Claude Usage, and it updates every 30 seconds with no issues. I think I’ll look into other alternatives instead of Open Usage. Thanks for the development. |
Owner
|
Sure, it's open source. Take it and modify it as you'd like. We're focusing on being considerate, as it's not about 'working' but not sending unnecessary requests to their servers. Nobody needs 30-second updates. |
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.
Description
Adds a "Custom" auto-refresh interval option so users can define their own polling frequency (down to 30 seconds) instead of being limited to the four fixed presets (5 min, 15 min, 30 min, 1 hour).
Changes:
src/lib/settings.ts: Widened AutoUpdateIntervalMinutes from 5 | 15 | 30 | 60 to number (still stored in minutes, supporting fractional values like 0.5 for 30s). Updated isAutoUpdateInterval validator to accept any finite number within bounds. Added MIN_CUSTOM_INTERVAL_MINUTES (0.5), MAX_CUSTOM_INTERVAL_MINUTES (1440), and utility functions isPresetInterval(), clampCustomInterval(), formatIntervalLabel().
src/pages/settings.tsx: Extracted AutoRefreshSection component with a two-row layout (presets on top, full-width Custom button below) to fit the 400px panel. Added CustomIntervalEditor with a number input, sec/min unit toggle (auto-converts values when switching), and a Set button. Supports Enter-to-confirm and blur-to-commit. Theme-aware styling for both light and dark modes. The type widening is fully backward-compatible — no changes needed in the Zustand store, hooks, bootstrap, or app-content layers.
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devScreenshots
Checklist
mainbranch