The application correctly switches to dark mode when the user changes the theme, but the selected preference is lost after refreshing the browser. As a result, users who prefer dark mode have to manually enable it every time they return to the application. The theme preference should be persisted and restored during application initialization without causing a flash of the incorrect theme.