holoviz / holoviz/param

Add concept of parameter preprocessor or allow invalidating watch events

Open
#324 1 comment 1 reaction 0 assignees View on GitHub
component: depends/watch status: discussion type-feature
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

In https://github.com/pyviz/param/pull/323 we addressed an issue with a pattern of using watch callbacks to validate and set parameter values. The concrete example was a watch callback which clipped a parameter value if it went above a certain value. In the discussion @martindurant and I established that in the general case what we implemented is the correct behavior, but that in the case of a validation callback you don't actually want the initial, **invalid** value to be trigger further events. There are two solutions we discussed:

1. Allow invalidating watch events, basically the validation callback could receive the event see that it is invalid and then call or set something on the event which suppresses it from generating any further events.

2. Allow defining pre-processors for parameters which can transform the value **before** it is set and therefore avoid sending the invalid event in the first place.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.