You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a large pages app (several dozen unrelated pages coded by different individuals) it would be helpful to not let an import exception in one page prevent the entire site from loading. We have hit cases where one developer has made assumptions that work in their local dev/test env but don't in production. It seems like _import_layouts_from_pages() could catch exceptions on import, print/log a message indicating which page is failing, and continue loading other pages.
A tangiential use case would be intentional prevention of page loading by simply throwing an import error, something like:
if app_enabled(__name__):
dash.register_page(__name__, "/page1")
else:
raise ImportError(f"{__name__} is currently not enabled")
Just guarding register_page is enough to preclude access but still loads unneeded resources from the file which an exception would prevent. My developers really only want to load the page(s) they're working on and ignore dozens of others for rapid test cycles. I'm sure there are many other solutions for conditional page import, this just seemed like one path requiring very little dash support aside from handling import expections (that doesn't involve moving/renaming files).
I can help with a PR if there is agreement on a path forward. Thanks.
The text was updated successfully, but these errors were encountered:
In a large pages app (several dozen unrelated pages coded by different individuals) it would be helpful to not let an import exception in one page prevent the entire site from loading. We have hit cases where one developer has made assumptions that work in their local dev/test env but don't in production. It seems like
_import_layouts_from_pages()
could catch exceptions on import, print/log a message indicating which page is failing, and continue loading other pages.A tangiential use case would be intentional prevention of page loading by simply throwing an import error, something like:
Just guarding register_page is enough to preclude access but still loads unneeded resources from the file which an exception would prevent. My developers really only want to load the page(s) they're working on and ignore dozens of others for rapid test cycles. I'm sure there are many other solutions for conditional page import, this just seemed like one path requiring very little dash support aside from handling import expections (that doesn't involve moving/renaming files).
I can help with a PR if there is agreement on a path forward. Thanks.
The text was updated successfully, but these errors were encountered: