Просмотр исходного кода

fix: the popup may show removed scripts

reported in #1824
tophf 2 лет назад
Родитель
Сommit
9cdebe3cf6
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      src/background/utils/db.js

+ 4 - 1
src/background/utils/db.js

@@ -392,7 +392,10 @@ export function notifyToOpenScripts(title, text, ids) {
  * @return {Promise<{ scripts: VMScript[], cache: Object }>}
  */
 export async function getData({ ids, sizes }) {
-  const scripts = getScriptsByIdsOrAll(ids);
+  const isPopup = ids && !sizes;
+  const scripts = isPopup // the popup may show a subsequently removed script
+    ? ids.map(id => scriptMap[id] || removedScripts.find(r => r.props.id === id)).filter(Boolean)
+    : getScriptsByIdsOrAll(ids);
   scripts.forEach(inferScriptProps);
   return {
     scripts,