mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
change the way frontend detects content change which works even if no new blob is created, fixes #4434
This commit is contained in:
parent
69ed3644f9
commit
cf068211ff
116
package-lock.json
generated
116
package-lock.json
generated
@ -15,7 +15,7 @@
|
||||
"@excalidraw/excalidraw": "0.16.1",
|
||||
"archiver": "6.0.1",
|
||||
"async-mutex": "0.4.0",
|
||||
"axios": "1.6.0",
|
||||
"axios": "1.6.1",
|
||||
"better-sqlite3": "8.4.0",
|
||||
"chokidar": "3.5.3",
|
||||
"cls-hooked": "4.2.2",
|
||||
@ -35,7 +35,7 @@
|
||||
"express-rate-limit": "7.1.4",
|
||||
"express-session": "1.17.3",
|
||||
"fs-extra": "11.1.1",
|
||||
"helmet": "7.0.0",
|
||||
"helmet": "7.1.0",
|
||||
"html": "1.0.0",
|
||||
"html2plaintext": "2.1.4",
|
||||
"http-proxy-agent": "7.0.0",
|
||||
@ -47,8 +47,8 @@
|
||||
"jimp": "0.22.10",
|
||||
"joplin-turndown-plugin-gfm": "1.0.12",
|
||||
"jsdom": "22.1.0",
|
||||
"katex": "^0.16.9",
|
||||
"marked": "9.1.5",
|
||||
"katex": "0.16.9",
|
||||
"marked": "9.1.6",
|
||||
"mime-types": "2.1.35",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"node-abi": "3.51.0",
|
||||
@ -81,7 +81,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "7.0.3",
|
||||
"electron": "25.9.3",
|
||||
"electron": "25.9.4",
|
||||
"electron-builder": "24.6.4",
|
||||
"electron-packager": "17.1.2",
|
||||
"electron-rebuild": "3.2.9",
|
||||
@ -96,11 +96,11 @@
|
||||
"jasmine": "5.1.0",
|
||||
"jsdoc": "4.0.2",
|
||||
"jsonc-eslint-parser": "2.4.0",
|
||||
"lint-staged": "15.0.2",
|
||||
"lint-staged": "15.1.0",
|
||||
"lorem-ipsum": "2.0.8",
|
||||
"nodemon": "3.0.1",
|
||||
"prettier": "3.0.3",
|
||||
"rcedit": "4.0.0",
|
||||
"prettier": "3.1.0",
|
||||
"rcedit": "4.0.1",
|
||||
"webpack": "5.89.0",
|
||||
"webpack-cli": "5.1.4"
|
||||
},
|
||||
@ -2475,9 +2475,9 @@
|
||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz",
|
||||
"integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==",
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
|
||||
"integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"form-data": "^4.0.0",
|
||||
@ -4366,9 +4366,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron": {
|
||||
"version": "25.9.3",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.3.tgz",
|
||||
"integrity": "sha512-dacaHg/PuwVcFRgPDCM5j7UDzqGJWOsbBRdS5wPKLNS/ejPeccIjuNUT1cqcrpvCJKAFW8swHWg9kdizNSEDHQ==",
|
||||
"version": "25.9.4",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.4.tgz",
|
||||
"integrity": "sha512-5pDU8a7o7ZIPTZHAqjflGMq764Favdsc271KXrAT3oWvFTHs5Ve9+IOt5EUVPrwvC2qRWKpCIEM47WzwkTlENQ==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@electron/get": "^2.0.0",
|
||||
@ -6926,9 +6926,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/helmet": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz",
|
||||
"integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==",
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.1.0.tgz",
|
||||
"integrity": "sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
@ -8413,9 +8413,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lint-staged": {
|
||||
"version": "15.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.0.2.tgz",
|
||||
"integrity": "sha512-vnEy7pFTHyVuDmCAIFKR5QDO8XLVlPFQQyujQ/STOxe40ICWqJ6knS2wSJ/ffX/Lw0rz83luRDh+ET7toN+rOw==",
|
||||
"version": "15.1.0",
|
||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.1.0.tgz",
|
||||
"integrity": "sha512-ZPKXWHVlL7uwVpy8OZ7YQjYDAuO5X4kMh0XgZvPNxLcCCngd0PO5jKQyy3+s4TL2EnHoIXIzP1422f/l3nZKMw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "5.3.0",
|
||||
@ -8427,7 +8427,7 @@
|
||||
"micromatch": "4.0.5",
|
||||
"pidtree": "0.6.0",
|
||||
"string-argv": "0.3.2",
|
||||
"yaml": "2.3.3"
|
||||
"yaml": "2.3.4"
|
||||
},
|
||||
"bin": {
|
||||
"lint-staged": "bin/lint-staged.js"
|
||||
@ -9086,9 +9086,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/marked": {
|
||||
"version": "9.1.5",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.5.tgz",
|
||||
"integrity": "sha512-14QG3shv8Kg/xc0Yh6TNkMj90wXH9mmldi5941I2OevfJ/FQAFLEwtwU2/FfgSAOMlWHrEukWSGQf8MiVYNG2A==",
|
||||
"version": "9.1.6",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz",
|
||||
"integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==",
|
||||
"bin": {
|
||||
"marked": "bin/marked.js"
|
||||
},
|
||||
@ -10475,9 +10475,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
|
||||
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz",
|
||||
"integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
@ -10730,9 +10730,9 @@
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||
},
|
||||
"node_modules/rcedit": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-4.0.0.tgz",
|
||||
"integrity": "sha512-OIPwu2e0b2WF4urFMcdiYUZGjmwh5pa52Mt847MK7ovxHkjpiPaI4Ov2atjeKTNFo4Tas0G31Qm7K21t87hp+g==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-4.0.1.tgz",
|
||||
"integrity": "sha512-bZdaQi34krFWhrDn+O53ccBDw0MkAT2Vhu75SqhtvhQu4OPyFM4RoVheyYiVQYdjhUi6EJMVWQ0tR6bCIYVkUg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn-windows-exe": "^1.1.0"
|
||||
@ -13549,9 +13549,9 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz",
|
||||
"integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==",
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||
"integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
@ -15522,9 +15522,9 @@
|
||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz",
|
||||
"integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==",
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
|
||||
"integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"form-data": "^4.0.0",
|
||||
@ -16964,9 +16964,9 @@
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "25.9.3",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.3.tgz",
|
||||
"integrity": "sha512-dacaHg/PuwVcFRgPDCM5j7UDzqGJWOsbBRdS5wPKLNS/ejPeccIjuNUT1cqcrpvCJKAFW8swHWg9kdizNSEDHQ==",
|
||||
"version": "25.9.4",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.4.tgz",
|
||||
"integrity": "sha512-5pDU8a7o7ZIPTZHAqjflGMq764Favdsc271KXrAT3oWvFTHs5Ve9+IOt5EUVPrwvC2qRWKpCIEM47WzwkTlENQ==",
|
||||
"requires": {
|
||||
"@electron/get": "^2.0.0",
|
||||
"@types/node": "^18.11.18",
|
||||
@ -18878,9 +18878,9 @@
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
|
||||
},
|
||||
"helmet": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz",
|
||||
"integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ=="
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.1.0.tgz",
|
||||
"integrity": "sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg=="
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.9",
|
||||
@ -19960,9 +19960,9 @@
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"version": "15.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.0.2.tgz",
|
||||
"integrity": "sha512-vnEy7pFTHyVuDmCAIFKR5QDO8XLVlPFQQyujQ/STOxe40ICWqJ6knS2wSJ/ffX/Lw0rz83luRDh+ET7toN+rOw==",
|
||||
"version": "15.1.0",
|
||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.1.0.tgz",
|
||||
"integrity": "sha512-ZPKXWHVlL7uwVpy8OZ7YQjYDAuO5X4kMh0XgZvPNxLcCCngd0PO5jKQyy3+s4TL2EnHoIXIzP1422f/l3nZKMw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "5.3.0",
|
||||
@ -19974,7 +19974,7 @@
|
||||
"micromatch": "4.0.5",
|
||||
"pidtree": "0.6.0",
|
||||
"string-argv": "0.3.2",
|
||||
"yaml": "2.3.3"
|
||||
"yaml": "2.3.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": {
|
||||
@ -20431,9 +20431,9 @@
|
||||
"requires": {}
|
||||
},
|
||||
"marked": {
|
||||
"version": "9.1.5",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.5.tgz",
|
||||
"integrity": "sha512-14QG3shv8Kg/xc0Yh6TNkMj90wXH9mmldi5941I2OevfJ/FQAFLEwtwU2/FfgSAOMlWHrEukWSGQf8MiVYNG2A=="
|
||||
"version": "9.1.6",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz",
|
||||
"integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q=="
|
||||
},
|
||||
"matcher": {
|
||||
"version": "3.0.0",
|
||||
@ -21478,9 +21478,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
|
||||
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz",
|
||||
"integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
@ -21663,9 +21663,9 @@
|
||||
}
|
||||
},
|
||||
"rcedit": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-4.0.0.tgz",
|
||||
"integrity": "sha512-OIPwu2e0b2WF4urFMcdiYUZGjmwh5pa52Mt847MK7ovxHkjpiPaI4Ov2atjeKTNFo4Tas0G31Qm7K21t87hp+g==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-4.0.1.tgz",
|
||||
"integrity": "sha512-bZdaQi34krFWhrDn+O53ccBDw0MkAT2Vhu75SqhtvhQu4OPyFM4RoVheyYiVQYdjhUi6EJMVWQ0tR6bCIYVkUg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn-windows-exe": "^1.1.0"
|
||||
@ -23772,9 +23772,9 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
"yaml": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz",
|
||||
"integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==",
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||
"integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
|
||||
"dev": true
|
||||
},
|
||||
"yargs": {
|
||||
|
16
package.json
16
package.json
@ -41,7 +41,7 @@
|
||||
"@excalidraw/excalidraw": "0.16.1",
|
||||
"archiver": "6.0.1",
|
||||
"async-mutex": "0.4.0",
|
||||
"axios": "1.6.0",
|
||||
"axios": "1.6.1",
|
||||
"better-sqlite3": "8.4.0",
|
||||
"chokidar": "3.5.3",
|
||||
"cls-hooked": "4.2.2",
|
||||
@ -61,7 +61,7 @@
|
||||
"express-rate-limit": "7.1.4",
|
||||
"express-session": "1.17.3",
|
||||
"fs-extra": "11.1.1",
|
||||
"helmet": "7.0.0",
|
||||
"helmet": "7.1.0",
|
||||
"html": "1.0.0",
|
||||
"html2plaintext": "2.1.4",
|
||||
"http-proxy-agent": "7.0.0",
|
||||
@ -73,8 +73,8 @@
|
||||
"jimp": "0.22.10",
|
||||
"joplin-turndown-plugin-gfm": "1.0.12",
|
||||
"jsdom": "22.1.0",
|
||||
"katex": "^0.16.9",
|
||||
"marked": "9.1.5",
|
||||
"katex": "0.16.9",
|
||||
"marked": "9.1.6",
|
||||
"mime-types": "2.1.35",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"node-abi": "3.51.0",
|
||||
@ -104,7 +104,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "7.0.3",
|
||||
"electron": "25.9.3",
|
||||
"electron": "25.9.4",
|
||||
"electron-builder": "24.6.4",
|
||||
"electron-packager": "17.1.2",
|
||||
"electron-rebuild": "3.2.9",
|
||||
@ -119,11 +119,11 @@
|
||||
"jasmine": "5.1.0",
|
||||
"jsdoc": "4.0.2",
|
||||
"jsonc-eslint-parser": "2.4.0",
|
||||
"lint-staged": "15.0.2",
|
||||
"lint-staged": "15.1.0",
|
||||
"lorem-ipsum": "2.0.8",
|
||||
"nodemon": "3.0.1",
|
||||
"prettier": "3.0.3",
|
||||
"rcedit": "4.0.0",
|
||||
"prettier": "3.1.0",
|
||||
"rcedit": "4.0.1",
|
||||
"webpack": "5.89.0",
|
||||
"webpack-cli": "5.1.4"
|
||||
},
|
||||
|
@ -180,7 +180,7 @@ class AbstractBeccaEntity {
|
||||
|
||||
sql.execute("DELETE FROM blobs WHERE blobId = ?", [oldBlobId]);
|
||||
// blobs are not marked as erased in entity_changes, they are just purged completely
|
||||
// this is because technically every keystroke can create a new blob and there would be just too many
|
||||
// this is because technically every keystroke can create a new blob, and there would be just too many
|
||||
sql.execute("DELETE FROM entity_changes WHERE entityName = 'blobs' AND entityId = ?", [oldBlobId]);
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ class AbstractBeccaEntity {
|
||||
isErased: false,
|
||||
utcDateChanged: pojo.utcDateModified,
|
||||
isSynced: true,
|
||||
// overriding componentId will cause frontend to think the change is coming from a different component
|
||||
// overriding componentId will cause the frontend to think the change is coming from a different component
|
||||
// and thus reload
|
||||
componentId: opts.forceFrontendReload ? utils.randomString(10) : null
|
||||
});
|
||||
|
@ -93,6 +93,9 @@ class FNote {
|
||||
* @type {string}
|
||||
*/
|
||||
this.mime = row.mime;
|
||||
|
||||
// the main use case to keep this is to detect content change which should trigger refresh
|
||||
this.blobId = row.blobId;
|
||||
}
|
||||
|
||||
addParent(parentNoteId, branchId, sort = true) {
|
||||
|
@ -369,12 +369,15 @@ class Froca {
|
||||
|
||||
/** @returns {Promise<FBlob>} */
|
||||
async getBlob(entityType, entityId) {
|
||||
// I'm not sure why we're not using blobIds directly, it would save us this composite key ...
|
||||
// perhaps one benefit is that we're always requesting the latest blob, not relying on perhaps faulty/slow
|
||||
// websocket update?
|
||||
const key = `${entityType}-${entityId}`;
|
||||
|
||||
if (!this.blobPromises[key]) {
|
||||
this.blobPromises[key] = server.get(`${entityType}/${entityId}/blob`)
|
||||
.then(row => new FBlob(row))
|
||||
.catch(e => console.error(`Cannot get blob for ${entityType} '${entityId}'`));
|
||||
.catch(e => console.error(`Cannot get blob for ${entityType} '${entityId}'`, e));
|
||||
|
||||
// we don't want to keep large payloads forever in memory, so we clean that up quite quickly
|
||||
// this cache is more meant to share the data between different components within one business transaction (e.g. loading of the note into the tab context and all the components)
|
||||
|
@ -20,18 +20,6 @@ async function processEntityChanges(entityChanges) {
|
||||
processAttributeChange(loadResults, ec);
|
||||
} else if (ec.entityName === 'note_reordering') {
|
||||
processNoteReordering(loadResults, ec);
|
||||
} else if (ec.entityName === 'blobs') {
|
||||
if (!ec.isErased) {
|
||||
for (const affectedNoteId of ec.noteIds) {
|
||||
for (const key of Object.keys(froca.blobPromises)) {
|
||||
if (key.includes(affectedNoteId)) {
|
||||
delete froca.blobPromises[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadResults.addNoteContent(ec.noteIds, ec.componentId);
|
||||
}
|
||||
} else if (ec.entityName === 'revisions') {
|
||||
loadResults.addRevision(ec.entityId, ec.noteId, ec.componentId);
|
||||
} else if (ec.entityName === 'options') {
|
||||
@ -44,7 +32,7 @@ async function processEntityChanges(entityChanges) {
|
||||
loadResults.addOption(ec.entity.name);
|
||||
} else if (ec.entityName === 'attachments') {
|
||||
processAttachment(loadResults, ec);
|
||||
} else if (ec.entityName === 'etapi_tokens') {
|
||||
} else if (ec.entityName === 'blobs' || ec.entityName === 'etapi_tokens') {
|
||||
// NOOP
|
||||
}
|
||||
else {
|
||||
@ -114,6 +102,16 @@ function processNoteChange(loadResults, ec) {
|
||||
delete froca.notes[ec.entityId];
|
||||
}
|
||||
else {
|
||||
if (note.blobId !== ec.entity.blobId) {
|
||||
for (const key of Object.keys(froca.blobPromises)) {
|
||||
if (key.includes(note.noteId)) {
|
||||
delete froca.blobPromises[key];
|
||||
}
|
||||
}
|
||||
|
||||
loadResults.addNoteContent(note.noteId, ec.componentId);
|
||||
}
|
||||
|
||||
note.update(ec.entity);
|
||||
}
|
||||
}
|
||||
|
@ -95,10 +95,8 @@ export default class LoadResults {
|
||||
return componentIds && componentIds.find(sId => sId !== componentId) !== undefined;
|
||||
}
|
||||
|
||||
addNoteContent(noteIds, componentId) {
|
||||
for (const noteId of noteIds || []) {
|
||||
this.contentNoteIdToComponentId.push({noteId, componentId});
|
||||
}
|
||||
addNoteContent(noteId, componentId) {
|
||||
this.contentNoteIdToComponentId.push({noteId, componentId});
|
||||
}
|
||||
|
||||
isNoteContentReloaded(noteId, componentId) {
|
||||
|
@ -58,7 +58,8 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
||||
title: note.getTitleOrProtected(),
|
||||
isProtected: note.isProtected,
|
||||
type: note.type,
|
||||
mime: note.mime
|
||||
mime: note.mime,
|
||||
blobId: note.blobId
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,6 @@ function fillInAdditionalProperties(entityChange) {
|
||||
if (!entityChange.entity) {
|
||||
entityChange.entity = sql.getRow(`SELECT * FROM options WHERE name = ?`, [entityChange.entityId]);
|
||||
}
|
||||
} else if (entityChange.entityName === 'blobs') {
|
||||
entityChange.noteIds = sql.getColumn("SELECT noteId FROM notes WHERE blobId = ? AND isDeleted = 0", [entityChange.entityId]);
|
||||
} else if (entityChange.entityName === 'attachments') {
|
||||
entityChange.entity = sql.getRow(`SELECT attachments.*, LENGTH(blobs.content) AS contentLength
|
||||
FROM attachments
|
||||
|
Loading…
x
Reference in New Issue
Block a user