Why is this happening you may ask. The JS code that forces the theme to
dark/light is set to run on page load.
https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/theme.js#L3
Because of this the full page loads for a moment with the dark theme, then
the page load event happens and then the js code changes the theme to
light.
The initTheme() and setTheme() functions don't really need to be inside
the event page load. Nothing in those 2 functions are doing anything that
require the entire page to be loaded. It is just using local storage and
modify the dataset on the html div. So those functions could be moved
outside of the on load event. I don't mind making the merge request for it
just wanted to get opinions on it.
--
Ticket URL: <https://code.djangoproject.com/ticket/34741>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/34741#comment:1>
* resolution: invalid => duplicate
Comment:
Duplicate of #34740.
--
Ticket URL: <https://code.djangoproject.com/ticket/34741#comment:2>