v0.0.23 - Fix theme toggle lag: use async XHR instead of sync to avoid 5-second UI freeze

This commit is contained in:
Laan Tungir
2026-07-13 07:45:55 -04:00
parent 12054b9900
commit aa2ad9a6cb
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
0.0.22
0.0.23
+4 -4
View File
@@ -507,9 +507,9 @@ static char *sovereign_page_head(const char *title) {
/* Build the theme-toggle button + closing </body></html>.
* Returns a newly-allocated string (g_free). */
static char *sovereign_page_foot(void) {
/* The theme toggle uses JavaScript to immediately flip the CSS class
* on <html> for an instant visual response, then saves the setting
* via XHR without a page reload. */
/* The theme toggle immediately flips the CSS class on <html> for an
* instant visual response, then fires an async XHR to save the setting
* in the background. No page reload, no UI blocking. */
return g_strdup_printf(
"<a class='theme-toggle' href='#' onclick='"
"var h=document.documentElement;"
@@ -518,7 +518,7 @@ static char *sovereign_page_foot(void) {
"else{h.classList.add(\"dark\");}"
"this.textContent=isDark?\"Night Mode\":\"Day Mode\";"
"var x=new XMLHttpRequest();"
"x.open(\"GET\",\"sovereign://settings/set?feature=theme_dark\",false);"
"x.open(\"GET\",\"sovereign://settings/set?feature=theme_dark\",true);"
"x.send();"
"return false;"
"'>%s</a>\n"
+2 -2
View File
@@ -11,9 +11,9 @@
#ifndef SOVEREIGN_BROWSER_VERSION_H
#define SOVEREIGN_BROWSER_VERSION_H
#define SB_VERSION "v0.0.22"
#define SB_VERSION "v0.0.23"
#define SB_VERSION_MAJOR 0
#define SB_VERSION_MINOR 0
#define SB_VERSION_PATCH 22
#define SB_VERSION_PATCH 23
#endif /* SOVEREIGN_BROWSER_VERSION_H */