refresh the just edited style entry after history back

This commit is contained in:
tophf 2018-08-30 09:23:55 +03:00
parent 681176ce31
commit 4f8953adde

View File

@ -658,8 +658,15 @@ function switchUI({styleOnly} = {}) {
function onVisibilityChange() { function onVisibilityChange() {
switch (document.visibilityState) { switch (document.visibilityState) {
// page restored without reloading via history navigation (currently only in FF) // page restored without reloading via history navigation (currently only in FF)
// the catch here is that DOM may be outdated so we'll at least refresh the just edited style
// assuming other changes aren't important enough to justify making a complicated DOM sync
case 'visible': case 'visible':
highlightEditedStyle(); if (sessionStorage.justEditedStyleId) {
API.getStyles({id: sessionStorage.justEditedStyleId}).then(([style]) => {
handleUpdate(style, {method: 'styleUpdated'});
});
delete sessionStorage.justEditedStyleId;
}
break; break;
// going away // going away
case 'hidden': case 'hidden':