AnnMarieW / dash-bootstrap-templates

A collection of 52 Plotly figure templates with a Bootstrap theme. Two theme switch components. Stylesheet to apply Bootstrap themes to Plotly Dash components.
https://hellodash.pythonanywhere.com/
MIT License
135 stars 25 forks source link

Fix persistence and add support of custom themes of theme changer #44

Closed sdidier-dev closed 2 weeks ago

sdidier-dev commented 1 month ago

Hi there! 😁 Here is a PR modifying the ThemeChangerAIO component inspired by the update of the ThemeSwitchAIO.

Change log:

sdidier-dev commented 1 month ago

New commit changelog:

mayushii21 commented 1 month ago

@sdidier-dev this does seem to properly apply persistent themes, but on the first theme load there's a split second flashbang (everything's white) while a theme is loading. So if you load the page, and then switch from theme_a to theme_b, everything will flash white for a second, then if you switch back, it'll be normal (I'm assuming this has to do with caching the themes CSS by the browser). This was not an issue in version 1.1.2

sdidier-dev commented 1 month ago

Hi @mayushii21! can you try with this last commit if that's better?

mayushii21 commented 1 month ago

@sdidier-dev while your solution did help, it still flashed on initial load, and relying on delays isn't best practice. I don't quite understand the logic flow of everything you were doing there, so I forked your fork and fiddled around. I created a pull request to your fork with a solution that seems to work well for me, relying on onload of the new stylesheet instead of delaying to set the href attribute. Please take a look. Not having to wait an entire half second also makes it feel a lot snappier - better user experience

sdidier-dev commented 4 weeks ago

Thanks @mayushii21 for the improvement!