Skip check on whether a component is passed as a non-children property. #1916
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Officially, Dash only supports passing other Dash components via the
children
prop. And for that reason (I guess), a check is being performed in the Python layer (inbase_component.py
) to catch if people try to do it,However, it is possible to render components passed via non-children properties - in fact I have developed some JS code (available in dash-extensions-js) that makes it possible to do it in a single line of code. This option dramatiacally improves the development experience and the flexibility of the resulting Dash components allowing stuff like,
This code already works with the current version of dash, but only because the list wrapping of the
Iconify
component cheats the check listed above. Hence the following code will not work with the current version of Dash,since the check will be hit. In this PR, I am proposing to remove the check so that the above code will work too.
The main limitation of this approach is that components rendered this way are now known by the dash renderer, so they cannot be targeted by callbacks.