Skip to content

refactor(settings): enhance auto-update interval handling#382

Closed
periakteon wants to merge 1 commit into
robinebers:mainfrom
periakteon:feat/custom-auto-refresh-interval
Closed

refactor(settings): enhance auto-update interval handling#382
periakteon wants to merge 1 commit into
robinebers:mainfrom
periakteon:feat/custom-auto-refresh-interval

Conversation

@periakteon
Copy link
Copy Markdown

  • 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.

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

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass
  • I tested the change locally with bun tauri dev

Screenshots

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

- 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.
@robinebers
Copy link
Copy Markdown
Owner

Hi, we put the 5-minute in place on purpose to not hammer them with requests.

Thanks

@robinebers robinebers closed this Apr 18, 2026
@periakteon
Copy link
Copy Markdown
Author

Hi, we put the 5-minute in place on purpose to not hammer them with requests.

Thanks

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.

@robinebers
Copy link
Copy Markdown
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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants