1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix dialog adding order

This commit is contained in:
Bill Thornton 2022-05-10 12:40:45 -04:00
parent c49f53257c
commit fb48309710

View file

@ -39,7 +39,7 @@ import '../../assets/css/scrollstyles.scss';
try { try {
parentNode.removeChild(elem); parentNode.removeChild(elem);
} catch (err) { } catch (err) {
console.error('error removing dialog element: ' + err); console.error('[dialogHelper] error removing dialog element: ' + err);
} }
} }
} }
@ -92,8 +92,12 @@ import '../../assets/css/scrollstyles.scss';
if (isHistoryEnabled(dlg)) { if (isHistoryEnabled(dlg)) {
const state = history.location.state || {}; const state = history.location.state || {};
if (state.dialogs?.length > 0 && state.dialogs[0] === hash) { if (state.dialogs?.length > 0) {
if (state.dialogs[0] === hash) {
history.back(); history.back();
} else if (state.dialogs.includes(hash)) {
console.info('[dialogHelper] dialog "%s" was closed, but is not the last dialog opened', hash);
}
} }
} }
@ -150,7 +154,8 @@ import '../../assets/css/scrollstyles.scss';
if (isHistoryEnabled(dlg)) { if (isHistoryEnabled(dlg)) {
const state = history.location.state || {}; const state = history.location.state || {};
const dialogs = state.dialogs || []; const dialogs = state.dialogs || [];
dialogs.push(hash); // Add new dialog to start of array
dialogs.unshift(hash);
history.push( history.push(
`${history.location.pathname}${history.location.search}`, `${history.location.pathname}${history.location.search}`,
@ -352,7 +357,7 @@ import '../../assets/css/scrollstyles.scss';
if (enableAnimation()) { if (enableAnimation()) {
backdrop.classList.remove('dialogBackdropOpened'); backdrop.classList.remove('dialogBackdropOpened');
// this is not firing animatonend // this is not firing animationend
setTimeout(onAnimationFinish, 300); setTimeout(onAnimationFinish, 300);
return; return;
} }