fix: load a chat channel on login/load

This commit is contained in:
Andy Burke 2026-01-21 15:40:13 -08:00
parent 32ed2dfd33
commit 6637927e20
3 changed files with 48 additions and 24 deletions

View file

@ -72,6 +72,21 @@ const APP = {
channel_id
});
}
if (!document.body.dataset.channel || document.body.dataset.channel !== channel_id) {
const previous = typeof document.body.dataset.channel === 'string' ? document.body.dataset.channel : undefined;
if ( channel_id ) {
document.body.dataset.channel = channel_id;
}
else {
delete document.body.dataset.channel;
}
this._emit( 'channel_changed', {
previous,
channel_id
});
}
},
load: async function() {
@ -234,3 +249,8 @@ const APP = {
};
document.addEventListener("DOMContentLoaded", APP.load.bind( APP ));
APP.on( 'view_changed', ( { view } ) => {
if ( !view ) {
window.location.hash = '/chat';
}
});