[WIP] Delay callback validation #644
Closed
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.
This is a proposed approach for handling delayed callback validation. As discussed in #519, immediate callback validation requires the Dash layout to be already set, imposing rigid constraints on where callbacks can be defined within a Dash app. In particular, this making arrangement of pages within multi-page apps that contain both callbacks and layout fragments impossible.
This change was more extensive than expected, so at the moment, this is perhaps more of way to get the conversation going.
Dash._callback_list
(distinct from theDash.callback_map
) when each callback is defined. The list is then used to perform validation when the app startsrun_server
, so I did not put this in the enable_dev_tools_folder, where I think there is a risk of users not running it. So instead I've created a_setup()
method that should both be run byrun_server
and alsoget_wsgi_application
, which would become the required way to get the WSGI callable for when using a WSGI server. This is modelled off Django's approach. So this is also a proposed solution to the general problem of keeping therun_server
and WSGI app entry points synchronised (which perhaps should go in a different PR though)Dash.callback_map
will be in a somewhat dirty state, with eg duplicate callbacks clobbering existing ones.