# Slider defer updates timing change

**URL:** <https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 17, 2024, 8:34pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350 "2024-07-17T20:34:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Austin\_Kyles](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Austin\_Kyles](https://forum.inductiveautomation.com/u/Austin_Kyles)\
**Post date:** [July 17, 2024, 8:34pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/1 "2024-07-17T20:34:44Z")

</div>

Currently with a bidirectional bind on a slider if defer updates is checked it seems to wait around 1 second of not actively changing the value to submit the value.

In the case that my user wants to sit and hold it while deciding or fine tuning the value on the touch screen this can cause unwanted results.

Is there any way to edit the timing on this?

---

<div class="post-metadata">

**Author:** ![simeonw](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@simeonw](https://forum.inductiveautomation.com/u/simeonw)\
**Post date:** [July 18, 2024, 8:38pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/2 "2024-07-18T20:38:26Z")

</div>

If I understand correctly, you want to wait until the user releases the slider before committing the value?

If there is a debounce on the slider value, then you might want to disable the bi-directional binding and use one of the events (onMouseUp, onPointerUp, onTouchEnd) to trigger a write to the tag/bidirectional param/custom prop

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [July 18, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/3 "2024-07-18T20:43:01Z")

</div>

I would make this a two-step process. Do not bind the slider bidirectionally to the target, instead add a submit button that pulls in the slider value then writes it to the tag.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [January 31, 2025, 8:57am UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/4 "2025-01-31T08:57:40Z")

</div>

Hi,

I understand the workarounds being suggested, but there are still some downsides to the proposed suggestions:

- Using **onMouseUp** : When you release your mouse outside the component, no event will be triggered
- Using a **two-step process** : sometimes it really makes no sense to make it a two step process.

Someone from my team came up with a different solutions, but I'd like to verify it's safe to use.

```python
from threading import Timer
from functools import wraps

# Initialize counter
c = 1

# Get logger instance
logger = system.util.getLogger("testdebounce")

def debounce(duration):
	"""Decorator to debounce function calls within a given duration."""
	def decorator(func):
		@wraps(func)
		def wrapper(*args, **kwargs):
			global c
			indx = c # Capture the current counter value

			def debounce_msg():
				"""Executes the function if it's the last invocation within the debounce period."""
				if c - 1 == indx:
					func(*args, **kwargs)

			# Start the timer to check if this is the last call
			Timer(duration, debounce_msg).start()
			
			# Increment the counter
			c += 1

		return wrapper
	return decorator

@debounce(0.3)
def printDebounce(msg, indx):
	"""Logs the message with debounce applied."""
	logger.info(msg)
	# system.perspective.print("MSG:" + str(msg) + ' ind ' + str(indx))

```

Doing this, makes sure we have a 'defer updates' functionality with the time delay that we want. However, I do wonder if this has the same drawbacks as time.sleep, or if it's just clean to do it like this. Any opinions?

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 7, 2025, 10:40am UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/5 "2025-02-07T10:40:41Z")

</div>

> [@louagejasper](#):
>
> ```python
> from threading import Timer
> from functools import wraps
> 
> # Initialize counter
> c = 1
> 
> # Get logger instance
> logger = system.util.getLogger("testdebounce")
> 
> def debounce(duration):
> """Decorator to debounce function calls within a given duration."""
> def decorator(func):
> @wraps(func)
> def wrapper(*args, **kwargs):
> global c
> indx = c # Capture the current counter value
> 
> def debounce_msg():
> """Executes the function if it's the last invocation within the debounce period."""
> if c - 1 == indx:
> func(*args, **kwargs)
> 
> # Start the timer to check if this is the last call
> Timer(duration, debounce_msg).start()
> 			
> # Increment the counter
> c += 1
> 
> return wrapper
> return decorator
> 
> @debounce(0.3)
> def printDebounce(msg, indx):
> """Logs the message with debounce applied."""
> logger.info(msg)
> 
> ```

@pturmel do you think this is dangerous code?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 7, 2025, 1:02pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/6 "2025-02-07T13:02:28Z")

</div>

Not so much dangerous, as burdensome. `Timer` starts a thread that immediately goes to sleep. That's pretty heavy weight. I would focus attention on eliminating the need for the debounce.

(I wouldn't ever use jython's `Timer`. Don't use stuff from the jython stdlib where java alternatives exist.)

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 7, 2025, 1:14pm UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/7 "2025-02-07T13:14:18Z")

</div>

Thanks for your input!

---

<div class="post-metadata">

**Author:** ![maxwell.carritt](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@maxwell.carritt](https://forum.inductiveautomation.com/u/maxwell.carritt)\
**Post date:** [August 25, 2025, 8:18am UTC](https://forum.inductiveautomation.com/t/slider-defer-updates-timing-change/93350/8 "2025-08-25T08:18:25Z")

</div>

sorry to comment on an old thread but rather than start a new one, i think this issue with the slider is a real one and should be solved at the component level , similar to the other input components: [deferUpdate option on numerical slider | Voters | Inductive Automation](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/deferupdate-option-on-numerical-slider)
