-
Notifications
You must be signed in to change notification settings - Fork 29
fix: Theme selection event listeners #3040
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
Conversation
The migration event needs to be used to set the event listeners for the theme select.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3040 +/- ##
=======================================
Coverage 70.08% 70.08%
=======================================
Files 215 215
Lines 6850 6850
=======================================
Hits 4801 4801
Misses 2049 2049 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@arkirchner I have major concerns with this change. Can you please provide some reasoning why you changed that, which bug you're fixing therewith, and what your long-term strategy is (without using the migration event)? From my point of view, the event listener is not bound to any Sprockets code; therefore, I don't see any necessity to wait longer for the delayed event. Furthermore, the delayed event will cause some extended, visible "white flashes" when navigating in dark mode. |
I can't speak for Armin but for me (locally) the appearance selector didn't always work and sometimes needed a reload. I have not seen that (yet?) with this fix. I also have not seen any of the flashes you mentioned in dark mode. |
Sorry I have overlooked this. I tried the theme change (production and local), and it never worked for me and my coworkers. It worked with the migration event. I did not notice the delay. I am migrating the Sprockets code here: #3021 |
Thanks for your comments. I've spent some additional time debugging, and it seems like some race condition in the previous version was, indeed, causing the buttons to be non-functional. Sorry for that, my fault. Since the code has been moved to webpack already, I think the event can be changed back to The flashing might be visible when changing from one page to another, when the included packs change. For example, when navigating from Long story short: Since the code has been moved to webpack, can we go back to |
My mistake! Not necessary! |
The `tubo:load` event is faster than the migration event. The color changing requires no sprocket code and can be controlled without the migration event. This removes the flickering in dark mode when navigating the page. This change is possible because the theme-changing logic was moved to Webpacker and loads before Sprockets. Please see #3025 Related to #3040
Alright, great! Thanks for the new PR 👍 |
The `tubo:load` event is faster than the migration event. The color changing requires no sprocket code and can be controlled without the migration event. This removes the flickering in dark mode when navigating the page. This change is possible because the theme-changing logic was moved to Webpacker and loads before Sprockets. Please see #3025 Related to #3040
The migration event needs to be used to set the event listeners for the theme select.