From 4f8953adde7c86b457dee61cb9369409591c3533 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 30 Aug 2018 09:23:55 +0300 Subject: [PATCH] refresh the just edited style entry after history back --- manage/manage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/manage/manage.js b/manage/manage.js index 7313a34f..01b005f8 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -658,8 +658,15 @@ function switchUI({styleOnly} = {}) { function onVisibilityChange() { switch (document.visibilityState) { // 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': - highlightEditedStyle(); + if (sessionStorage.justEditedStyleId) { + API.getStyles({id: sessionStorage.justEditedStyleId}).then(([style]) => { + handleUpdate(style, {method: 'styleUpdated'}); + }); + delete sessionStorage.justEditedStyleId; + } break; // going away case 'hidden':