-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
page_sidebar
and page_navbar
should drop sidebar
parameter and accept Sidebar
objects in *args
#939
Comments
This motivation feels off to me as the API for Core is being driven by Express. (However, I am happy to have differences between Express and Core for usability!) I'd like to keep as much static type checking as possible within Core. Because the I am ok with continuing to have If we do keep this proposal, should we also apply it to @wch What about having |
The motivation is in part to improve the Express API, but also to improve the Core API. That said, I think it can make sense to make changes to the Core API to reflect the Express API, if it provides a more consistent experience and learning ramp. If we were to keep the status quo, then there would be one way of structuring the UI code for Express, and a different way of structuring the code for Core:
This means that the transition from Express to Core would require learning a new way of structuring the layout code. There is also the inconsistency in the Core between the
The drawback to the proposed change is that in |
Couple of thoughts:
Longer-term, maybe it doesn't make sense to have |
There are a number of open questions, so we're going to defer this for after the 0.7.0 release. |
Even just within Core, I think there's a strong argument to be made to align the function signatures of # from
ui.page_sidebar(
ui.sidebar(),
*children
)
# to
ui.page_navbar(
ui.sidebar(),
ui.nav_panel(
*children
)
)
# instead of
ui.page_navbar(
ui.nav_panel(
*children
),
sidebar = ui.sidebar()
) |
Currently,
page_sidebar()
andpage_navbar()
take an explicitsidebar
argument.However, for
page_auto()
, which is used in Express mode, there's nosidebar
argument (because children can't be passed as named arguments in Express). Instead, we inspect the*args
, pull out anySidebar
objects, and then explicitly pass them to thesidebar
argument.py-shiny/shiny/ui/_page.py
Lines 529 to 530 in a020af6
Also, because of how Python handles named and unnamed ages:
page_sidebar()
, the signature ispage_sidebar(sidebar, *args)
. This means that the sidebar must be the first argument and must not be named.page_navbar()
, the signature ispage_navbar(*args, sidebar)
. This means that the sidebar must not be the first argument, and must be named.I think we should remove the
sidebar
parameter from these functions and simply inspect the*args
forSidebar
objects -- essentially, take the logic frompage_auto()
and move it intopage_sidebar()
andpage_navbar()
.The text was updated successfully, but these errors were encountered: