allow Custom Wildcard
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Is your feature request related to a problem? Please describe.
I want to create my own custom _Wildcard class such that I don't have to rely on the pre-defined ones for cases where I need extra flexibility.
A use-case I keep coming up to is the following:
STARTSWITH = _Wildcard("STARTSWITH")
@app.callback(
Output({"type": "row", "index": STARTSWITH}, "hidden"),
[Input({"type": "collapse-button", "index": STARTSWITH}, "n_clicks")],
[State({"type": "row", "index": STARTSWITH}, "hidden")]
)
def callback(btn, rows)
This is really just a way to identify a parent-children relationship (1-n) such that when clicking the parent button, the relevant children row components get retrieved at the same time.
This is useful because components can't have the same ID and so not currently easy to do AFAIK.
Describe the solution you'd like
I would like to be able to define a _Wildcard class with my own callable, which would essentially work as a custom comparator, to filter out Dash Components I don't need in a given callback.
Describe alternatives you've considered
- I tried using
ALLand thecontextsuch that I iterate through and update the changed components - this is extremely inefficient as the number of buttons grow (1k+) regardless of callback time complexity - page slows down to unusable levels. - I tried dynamically creating multiple specific callbacks at runtime (~5k) for each combination of components by wrapping a callable which can work on a singular piece of data at a time. This in combination with
prevent_initial_updateseems to alleviate the performance issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named in the issue. Start by reviewing the existing wildcard behavior, including ALL and callback context, then determine where a user-defined callable comparator would fit; done means custom _Wildcard instances can filter matching components for the described parent-child callback without requiring thousands of callbacks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100