panel icon indicating copy to clipboard operation
panel copied to clipboard

Theme change (and other visual settings if any) should not enter browser history

Open michaelaye opened this issue 4 years ago • 6 comments

Is your feature request related to a problem? Please describe.

When I use the theme switcher on this demo for example:

https://panel.holoviz.org/gallery/simple/file_download_examples.html#simple-gallery-file-download-examples

I noticed that when trying to go back to the gallery, I need to walk back through the previous theme settings, which isn't fun, especially b/c the theme switch takes several seconds, and I believe it is also common to not have theme switches or other purely visual settings enter the browser history for a dashboard.

Describe the solution you'd like

To not have theme and other visual settings enter the browser history.

Describe alternatives you've considered

I don't know any.

michaelaye avatar Sep 28 '21 01:09 michaelaye

Agreed, may have to manually edit the browser history stack. It's not something I've read deeply about.

philippjfr avatar Sep 28 '21 08:09 philippjfr

Having the theme be persisted in the URL in a way that the dashboard can be revisited seems like a feature, not a bug, but I agree that if it takes seconds to scroll through the history it would get annoying...

jbednar avatar Sep 28 '21 18:09 jbednar

which is why this isn't a bug report! ;) I don't know enough about browsers, but shouldn't both be possible somehow? Have a URL-based theme landing but have the panel code edit the browser stack's history nevertheless?

michaelaye avatar Sep 28 '21 20:09 michaelaye

err? I just tried above link with FF instead of Brave, and it does what I asked for, went immediately back here, after switching the theme back and forth 3 times?

Additionally (maybe a new issue?) I counted 4 seconds for each theme switch and I saw that the status bar everytime said something like "Transferring data from panel.holoviz.org..." Maybe some local caching of theme related data would be nice?

michaelaye avatar Sep 28 '21 20:09 michaelaye

Having theme theme switch trigger a browser refresh is there for historical and technical reasons.

  • The Fast HTML and CSS no longer need the refresh. Initially it did.
    • It's actually just necessary to update one js value.
  • But plots and other non-bokeh components still need some handling.
    • For bokeh (holoviews) based plots the bokeh theme could probably be updated on the js side. This is the key part.
    • For other plotting libraries the theme change would probably have to be handled by the user on the python side.
      • So the theme (or background_color) parameter needs to be synced between python and js side and the user needs to let their code depend on it.

But making this work in practice would probably need some knowledge and work that only @philippjfr is capable of doing.

In my world this would be solved as a part of a general makeover of the Templates. ReactiveHTML will enable us to simplify the templates and make them dynamic. For the Fast templates the first and main building block is here https://github.com/panel-components/panel-fast/pull/2

MarcSkovMadsen avatar Sep 29 '21 09:09 MarcSkovMadsen

I think there's some confusion here, the problem isn't that it requires a refresh but that each refresh goes into the browser history which means that when you click "previous page" in your browser you pointlessly have to go back twice (or more).

philippjfr avatar Sep 29 '21 09:09 philippjfr