fix: auto-refresh page when closing Settings with X
closeSettings() now: - Refreshes the parent page (history.back + reload) - Handles tab navigation between settings sections - Falls back to /workspaces redirect if no history
This commit is contained in:
@@ -799,12 +799,26 @@ document.addEventListener('alpine:init', function() {
|
||||
} catch(e) {}
|
||||
},
|
||||
closeSettings() {
|
||||
// Go back to previous page, skipping any hash-only navigation
|
||||
if (document.referrer && document.referrer.includes('/settings')) {
|
||||
// Came from another settings tab — use history until we leave settings
|
||||
// Refresh parent page after settings changes, then navigate back
|
||||
if (window.opener && !window.opener.closed) {
|
||||
window.opener.location.reload();
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
// If navigated directly to settings, redirect to workspaces (forces refresh)
|
||||
if (!document.referrer || document.referrer === window.location.href) {
|
||||
window.location.href = '/workspaces?ts=' + Date.now();
|
||||
return;
|
||||
}
|
||||
// Go back and force refresh
|
||||
var prev = document.referrer;
|
||||
if (prev && prev.includes('/settings')) {
|
||||
// Came from another settings tab — go back two steps then refresh
|
||||
history.go(-2);
|
||||
setTimeout(function() { window.location.reload(); }, 100);
|
||||
} else {
|
||||
history.back();
|
||||
setTimeout(function() { window.location.reload(); }, 100);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user