aio components custom attributes not passed down
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Describe your context
dash 2.3.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-labs 1.0.3
dash-table 5.0.0
Following six line demonstrator works with static layout:
app.layout = layout()
but fails to initialise when invoked dynamically:
app.layout = layout
The issue is with the method simple_clone(), in dash.py/L566. The Dash layout clone method
fails to pass in the value total_items=100. This is significant problem since the sub-classing the
standard Dash components is used extensively when implementing the reusable components
AIO pattern.
class MyDiv(html.Div):
def __init__(self, children=None, className='some-class', total_items=None, page_size=10):
# Fails with TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
pages = total_items / page_size
print(pages)
super().__init__(pages, className=className)
def layout():
return MyDiv(total_items=100)
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
Start in dash.py around L566 and inspect simple_clone() using the supplied MyDiv example. Compare static layout() with dynamic layout and verify that the total_items=100 custom attribute is preserved so the dynamic layout initializes without the shown TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100