Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing value_throttled as a query parameter should raise an Exception #7481

Open
1 task
MP-MaximilianLattka opened this issue Nov 11, 2024 · 1 comment
Open
1 task

Comments

@MP-MaximilianLattka
Copy link
Contributor

MP-MaximilianLattka commented Nov 11, 2024

ALL software version info

Software Version Info
Python 3.12.7
Panel 1.5.3

Description of expected behavior and the observed behavior

value_throttled of various widgets is a read-only attribute and it is not possible to hook it up via pn.state.location.sync. I would expect an exception to be raised if the user attempts to do so anyways.

(Please don't confuse this issue with #7482 which features a similar code snippet)

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
import pandas as pd

pn.extension("tabulator", notifications=False)

template = pn.template.BootstrapTemplate()

df_full = pd.DataFrame({"year": list(range(2000, 2021))})

table = pn.widgets.Tabulator(df_full)
slider = pn.widgets.RangeSlider(start=2000, end=2020, name='Years')

@pn.depends(slider.param.value_throttled, watch=True)
def filter_df(value):
    start, end = value
    table.value = df_full[(df_full["year"] >= start) & (df_full["year"] <= end)]

if pn.state.location:
    pn.state.location.sync(slider, {"value_throttled": "years"})

template.main.append(pn.Column(table))
template.sidebar.append(pn.Column(slider))
template.servable();

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

  • I may be interested in making a pull request to address this
@jbednar
Copy link
Member

jbednar commented Nov 11, 2024

I can reproduce this issue, which to me seems like a bug (if only a bug in our error checking).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants