[PR #155] [MERGED] Fix: Allow cycles parameter to accept 0 to disable auto-switching #134

Closed
opened 2026-03-03 11:14:36 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/debloper/xiosk/pull/155
Author: @Lasithih
Created: 2/7/2026
Status: Merged
Merged: 2/17/2026
Merged by: @debloper

Base: mainHead: main


📝 Commits (2)

  • 5c9ba0e Allow cycles input to accept zero
  • 3bd9caf Fix backend handling for cycles

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 dashboard/script.js (+3 -3)

📄 Description

Fix: Allow cycles parameter to accept 0 to disable auto-switching

Problem

The dashboard frontend currently parses the cycles input value using:

parseInt($(item).find('.cycles-input').val()) || 10

This causes 0 to be treated as falsy, defaulting to 10 instead of being accepted as a valid value.

Solution

Use the nullish coalescing operator to properly handle 0:

parseInt($(item).find('.cycles-input').val()) ?? 10

Backend Compatibility

The switcher script already supports 0 to skip refreshing:

# Only run refresh logic if cycle_target is greater than 0
if [ "$cycle_target" -gt 0 ]; then

Use Case

When displaying static dashboards (e.g., Grafana), disabling the xiosk-switcher service gets overridden on configuration updates. Setting cycles=0 provides a cleaner way to disable auto-switching without stopping the service.


Related to #63


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/debloper/xiosk/pull/155 **Author:** [@Lasithih](https://github.com/Lasithih) **Created:** 2/7/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@debloper](https://github.com/debloper) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`5c9ba0e`](https://github.com/debloper/xiosk/commit/5c9ba0e2cfe654bf6ceacb2af9da0ab9f95e36d3) Allow cycles input to accept zero - [`3bd9caf`](https://github.com/debloper/xiosk/commit/3bd9cafe6d60fb15bd707cf90b92498e561450e9) Fix backend handling for cycles ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `dashboard/script.js` (+3 -3) </details> ### 📄 Description ## Fix: Allow `cycles` parameter to accept `0` to disable auto-switching ### Problem The dashboard frontend currently parses the `cycles` input value using: ```javascript parseInt($(item).find('.cycles-input').val()) || 10 ``` This causes `0` to be treated as falsy, defaulting to `10` instead of being accepted as a valid value. ### Solution Use the nullish coalescing operator to properly handle `0`: ```javascript parseInt($(item).find('.cycles-input').val()) ?? 10 ``` ### Backend Compatibility The switcher script already supports `0` to skip refreshing: ```shell # Only run refresh logic if cycle_target is greater than 0 if [ "$cycle_target" -gt 0 ]; then ``` ### Use Case When displaying static dashboards (e.g., Grafana), disabling the xiosk-switcher service gets overridden on configuration updates. Setting `cycles=0` provides a cleaner way to disable auto-switching without stopping the service. --- Related to #63 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 11:14:36 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/xiosk#134
No description provided.