From 8e531e2db56268247e39296949dd0aea8ae4ff5f Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Mon, 4 Nov 2024 21:31:35 +0100 Subject: [PATCH] fix Compact Database --- package.json | 2 +- packages/home/settings.tsx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 74845440..ca29fb07 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "Envox ", "description": "Cross-platform visual development tool and SCPI instrument controller", "homepage": "https://www.envox.hr/eez/studio/studio-introduction.html", - "version": "0.19.0", + "version": "0.20.0", "revision": "1", "license": "GPL-3.0-only", "repository": "https://github.com/eez-open/studio", diff --git a/packages/home/settings.tsx b/packages/home/settings.tsx index 7370358d..f23e0259 100644 --- a/packages/home/settings.tsx +++ b/packages/home/settings.tsx @@ -1,3 +1,4 @@ +import fs from "fs"; import { ipcRenderer, shell, clipboard } from "electron"; import { dialog, getCurrentWindow } from "@electron/remote"; import { confirm } from "eez-studio-ui/dialog-electron"; @@ -390,12 +391,12 @@ class SettingsController { } }; - compactDatabase() { + compactDatabase = () => { if (!this.selectedDatabase) { return; } showDialog(); - } + }; } export const settingsController = new SettingsController(); @@ -419,18 +420,17 @@ const CompactDatabaseDialog = observer( sizeReduced: observable }); - var fs = require("fs"); - this.sizeBefore = fs.statSync( - this.props.database.databaseSize - ).size; + this.sizeBefore = fs.statSync(this.props.database.filePath).size; } async componentDidMount() { try { await dbVacuum(); - this.props.database.timeOfLastDatabaseCompactOperation = - Date.now(); + runInAction(() => { + this.props.database.timeOfLastDatabaseCompactOperation = + Date.now(); + }); runInAction(() => { var fs = require("fs");