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
Error in : session$setCurrentTheme() cannot be used to change the Bootstrap version from to 5. Try using `bs_theme(version = 5)` for initial theme.
I find two issues with the error message:
Because no theme was initially explicitly set, the text says "version from to 5". Grammar is incorrect, a number is missing there
The solution of trying to use bs_theme(version=5) for initial theme is pointing in the right direction, but it's a little unclear where you should be using that function call. It would be much better if it said that you need to make this call in the UI definition of the page.
But in my opinion this behaviour in itself suboptimal and has two large problems from a UX perspective:
I should be able to use bslib::bs_theme() to change one aspect of the theme at some point in the app regardless of whether or not I made a call in the UI with a version number. The above code should just work. Currently shiny uses bootstrap3 by default, so it should just assume that version 3 is used if none is explicitly given.
Even if I did make a call in the UI to initialize to bootstrap version 3, the above code would still fail, because it would say I'm trying to change from v3 to v5. There's a usability problem in that, because it means that every single time I call bs_theme() I'm expected to repeat the version number. I think if no version is provided to the function, then it should just use the last version used.
Slightly off topic, but it's also a bit unclear IMO that shiny uses version 3 by default, but if you call bs_theme() it'll default to 5 -- I understand it, but I think it can be very confusing what is meant by "default version" when there are two meanings to it.
The text was updated successfully, but these errors were encountered:
daattali
changed the title
session$setCurrentTheme(bs_theme): confusing behaviour+error message if UI doesn't initially set theme
session$setCurrentTheme(bs_theme): confusing behaviour+error message regarding version
Jun 1, 2024
It's reasonable to expect the following to work:
It results in the following error:
I find two issues with the error message:
bs_theme(version=5)
for initial theme is pointing in the right direction, but it's a little unclear where you should be using that function call. It would be much better if it said that you need to make this call in the UI definition of the page.But in my opinion this behaviour in itself suboptimal and has two large problems from a UX perspective:
bslib::bs_theme()
to change one aspect of the theme at some point in the app regardless of whether or not I made a call in the UI with a version number. The above code should just work. Currently shiny uses bootstrap3 by default, so it should just assume that version 3 is used if none is explicitly given.bs_theme()
I'm expected to repeat the version number. I think if no version is provided to the function, then it should just use the last version used.Slightly off topic, but it's also a bit unclear IMO that shiny uses version 3 by default, but if you call
bs_theme()
it'll default to 5 -- I understand it, but I think it can be very confusing what is meant by "default version" when there are two meanings to it.The text was updated successfully, but these errors were encountered: