Sv443 10 месяцев назад
Родитель
Сommit
2bbad1d01a
3 измененных файлов с 8 добавлено и 4 удалено
  1. 1 1
      src/components/ExportImportDialog.ts
  2. 1 0
      src/dialogs/autoLike.ts
  3. 6 3
      src/menu/menu_old.ts

+ 1 - 1
src/components/ExportImportDialog.ts

@@ -38,7 +38,7 @@ export class ExImDialog extends BytmDialog {
       closeOnBgClick: true,
       closeOnEscPress: true,
       closeBtnEnabled: true,
-      destroyOnClose: true,
+      unmountOnClose: true,
       small: true,
       ...options,
     });

+ 1 - 0
src/dialogs/autoLike.ts

@@ -65,6 +65,7 @@ export async function getAutoLikeDialog() {
           siteEvents.emit("autoLikeChannelsUpdated");
 
           showToast({ message: t("import_success") });
+          autoLikeImExDialog?.unmount();
         }
         catch(err) {
           error("Couldn't import auto-like channels data:", err);

+ 6 - 3
src/menu/menu_old.ts

@@ -179,13 +179,16 @@ async function mountCfgMenu() {
     height: 600,
     // try to compress the data if possible
     exportData: async () => await compressionSupported()
-      ? await compress(JSON.stringify(getFeatures()), compressionFormat, "string")
-      : JSON.stringify(getFeatures()),
+      ? await compress(JSON.stringify({ formatVersion, data: getFeatures() }), compressionFormat, "string")
+      : JSON.stringify({ formatVersion, data: getFeatures() }),
     // copy plain when shift-clicking the copy button
     exportDataSpecial: () => JSON.stringify(getFeatures()),
     onImport: async (data) => {
       try {
         const parsed = await tryToDecompressAndParse<{ data: FeatureConfig, formatVersion: number }>(data.trim());
+
+        console.log(">> parsed", parsed);
+
         if(!parsed || typeof parsed !== "object")
           return alert(t("import_error_invalid"));
         if(typeof parsed.formatVersion !== "number")
@@ -225,8 +228,8 @@ async function mountCfgMenu() {
           return location.reload();
         }
 
-        emitSiteEvent("rebuildCfgMenu", parsed.data);
         exImDlg.unmount();
+        emitSiteEvent("rebuildCfgMenu", parsed.data);
       }
       catch(err) {
         warn("Couldn't import configuration:", err);