Skip to content

throw an error if there is more than 5000 slider marks #3350

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Jun 27, 2025

resolve #3331

Copy link
Contributor

@gvwilson gvwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - @ndrezn please have a look as well.

@ndrezn
Copy link
Member

ndrezn commented Jun 27, 2025

@chriddyp / @cleaaum is an error message here sufficient? I ask because in theory we expect an agent to respond to error messages and address them, so it will require an additional loop.

The other options here are:

  1. Throw a warning, and/or
  2. Truncate automatically to 5k or so ticks... but how do we decide how to downsample? Is 5k the right upper bound in this case? Usually we would want far fewer.
  3. If more than 5k (or go way lower, like 200-1k marks, where usability starts to fall off) marks, just use the default settings (~5 marks)

Ticks are auto generated if not explicitly provided, so could we expect to just leave this unspecified? See: https://dash.plotly.com/dash-core-components/slider#auto-generated-marks

@cleaaum
Copy link

cleaaum commented Jun 27, 2025

I think using the default settings could be useful (~5 ticks) with a warning message that its done that - makes it a little easier to use

@gvwilson
Copy link
Contributor

@cleaaum would you want generated code to always use the default, or do you want the library to switch to the 5-tick default if the requested number of ticks is too large?

@emilykl
Copy link
Contributor

emilykl commented Jun 27, 2025

If I understand correctly, the main issue we want to resolve is that if the user supplies too many ticks to dcc.Slider in their code, the Dash app becomes unresponsive in the browser — is that correct?

So we want to avoid the scenario where the Dash app is unresponsive (due to too many ticks).

If that's correct, I think it would be reasonable for dcc.Slider to ignore the marks value if it's above some threshold and log a warning saying it's done so. So basically I agree with @cleaaum .

@cleaaum
Copy link

cleaaum commented Jun 27, 2025

@gvwilson the latter: would want the library to switch to the 5-tick default if the requested number of ticks is too large.

@ndrezn
Copy link
Member

ndrezn commented Jun 30, 2025

Let's go with that route and start with 500 ticks, which feels like a reasonable starting place.

So:

  1. If a user supplies > 500 ticks,
  2. Default to standard behaviour (~5 ticks),
  3. Raise a warning in the Javascript console (not the Python console) that the tick count was reduced, as the overwrite happens in the frontend

Sound good?

@emilykl
Copy link
Contributor

emilykl commented Jun 30, 2025

@T4rk1n Do you feel strongly that the substitution should happen in the frontend rather than the backend? (I don't feel strongly either way but my Python brain naturally thinks of Python implementations first.)

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