feat: allow to disable version check#3137
Conversation
Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
📝 WalkthroughWalkthroughAdds a ChangesVersion Check Toggle
Sequence DiagramsequenceDiagram
participant Frontend as Browser UI
participant Settings as Settings Context
participant API as /api/v1/status
participant Github as GitHub API
Frontend->>Settings: read currentSettings.versionCheck
Frontend->>API: GET /api/v1/status?checkUpdateAvailable=true/false
alt checkUpdateAvailable == true
API->>Github: query releases/commits
Github-->>API: release/commit info
API-->>Frontend: status + updateAvailable + commitsBehind
else
API-->>Frontend: status (no updateAvailable/commitsBehind)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/Settings/SettingsMain/index.tsx (1)
213-215:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid forcing a status revalidation right after turning version checks off.
On Line 214,
mutate('/api/v1/status')runs unconditionally. If the user disablesversionCheck, this still triggers one immediate status call right after save. Gate that mutate byvalues.versionCheckso opt-out takes effect immediately.Suggested change
mutate('/api/v1/settings/public'); - mutate('/api/v1/status'); + if (values.versionCheck) { + mutate('/api/v1/status'); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/Settings/SettingsMain/index.tsx` around lines 213 - 215, The unconditional call to mutate('/api/v1/status') after saving settings forces a status revalidation even when the user turns off version checks; update the save handler that calls mutate('/api/v1/settings/public') and mutate('/api/v1/status') to only call mutate('/api/v1/status') when values.versionCheck is true (i.e., gate the second mutate by checking values.versionCheck) so that opting out of versionCheck takes effect immediately.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@seerr-api.yml`:
- Around line 253-255: The OpenAPI schema's example for the boolean property
versionCheck conflicts with the runtime default (initialized as true); update
the schema example for versionCheck from false to true so the example aligns
with the actual initialized default and avoids misleading API consumers (locate
the versionCheck property in the schema and change its example value).
In `@src/components/StatusChecker/index.tsx`:
- Around line 26-31: The current useSWR call disables all /api/v1/status polling
when settings.currentSettings.versionCheck is false which prevents
data.restartRequired from updating; change the client to always poll a
lightweight restart-status endpoint (or always fetch the restart flag) instead
of passing null when versionCheck is off — e.g., keep useSWR for restart status
regardless of settings.currentSettings.versionCheck (call a dedicated endpoint
like '/api/v1/status/restart' or always request '/api/v1/status' but have the
backend short-circuit the GitHub check while still returning restartRequired).
Update references around useSWR, settings.currentSettings.versionCheck,
'/api/v1/status' and data.restartRequired to use the new endpoint/logic so
restart-required modals continue to work even when versionCheck is disabled.
In `@src/context/SettingsContext.tsx`:
- Around line 34-35: The settings selection currently falls back to
defaultSettings whenever an SWR error exists, which can overwrite valid
stale/fallback data (e.g., flipping versionCheck). In SettingsContext.tsx update
the selection logic that uses error to choose defaultSettings so it instead
prefers any available SWR data/fallback (the `data` returned from useSWR or its
`fallbackData`) before falling back to `defaultSettings`; adjust the code around
the variables `data`, `error`, and `defaultSettings` (and the final
`settings`/`versionCheck` value) so stale data is used when present even if
`error` is truthy.
---
Outside diff comments:
In `@src/components/Settings/SettingsMain/index.tsx`:
- Around line 213-215: The unconditional call to mutate('/api/v1/status') after
saving settings forces a status revalidation even when the user turns off
version checks; update the save handler that calls
mutate('/api/v1/settings/public') and mutate('/api/v1/status') to only call
mutate('/api/v1/status') when values.versionCheck is true (i.e., gate the second
mutate by checking values.versionCheck) so that opting out of versionCheck takes
effect immediately.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bbb2bdbf-960d-4a02-b525-74eca6c885f5
📒 Files selected for processing (10)
seerr-api.ymlserver/interfaces/api/settingsInterfaces.tsserver/lib/settings/index.tssrc/components/Layout/VersionStatus/index.tsxsrc/components/Settings/SettingsAbout/index.tsxsrc/components/Settings/SettingsMain/index.tsxsrc/components/StatusChecker/index.tsxsrc/context/SettingsContext.tsxsrc/i18n/locale/en.jsonsrc/pages/_app.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/Layout/VersionStatus/index.tsx`:
- Around line 73-89: The JSX currently uses a truthy check "{data.commitsBehind
&& (...)}" which hides the valid 0 state; update the guard in the VersionStatus
component to check for presence (e.g., data.commitsBehind !== undefined &&
data.commitsBehind !== null or Number.isFinite(data.commitsBehind)) instead of
truthiness so that commitsBehind === 0 still renders the inner span and the
subsequent branches that use data.commitTag,
intl.formatMessage(messages.commitsbehind), messages.outofdate, and data.version
are evaluated correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1617203a-4ca5-49c9-810f-a35fcce52f44
📒 Files selected for processing (5)
seerr-api.ymlserver/interfaces/api/settingsInterfaces.tsserver/routes/index.tssrc/components/Layout/VersionStatus/index.tsxsrc/components/StatusChecker/index.tsx
Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
729a892 to
55cd7b3
Compare
Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
Description
Allow to disable version check.
How Has This Been Tested?
In local
Screenshots / Logs (if applicable)
The button

Version check enabled

Version check disabled

Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit