Skip to content

Commit caccb8a

Browse files
authored
fix: Faster theme loading to avoid flickering (#3062)
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
1 parent ffef585 commit caccb8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/javascript/sprocket-asset-import/color-mode-picker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function showActiveTheme(theme, focus = false) {
7777
}
7878
}
7979

80-
$(document).on('turbo-migration:load', function() {
80+
$(document).on('turbo:load', function() {
8181
setTheme(getPreferredTheme())
8282

8383
showActiveTheme(getPreferredTheme())

0 commit comments

Comments
 (0)