mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-07 17:02:29 +01:00
fix (upload): edge case event will reset cache
This commit is contained in:
parent
2e54875c92
commit
aed5a61f22
1 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { setup_cache_state } from ".";
|
import { setup_cache_state } from ".";
|
||||||
import { currentBackend, currentShare } from "./cache_state.js";
|
import { currentBackend, currentShare } from "./cache_state.js";
|
||||||
|
import Path from "path";
|
||||||
|
|
||||||
const DB_VERSION = 4;
|
const DB_VERSION = 4;
|
||||||
const FILE_PATH = "file_path";
|
const FILE_PATH = "file_path";
|
||||||
|
|
@ -337,8 +338,9 @@ export function setup_cache() {
|
||||||
.then(() => cache.update(FILE_PATH, [currentBackend(), currentShare(), currentPath], (response) => {
|
.then(() => cache.update(FILE_PATH, [currentBackend(), currentShare(), currentPath], (response) => {
|
||||||
response.results = response.results.reduce((acc, file) => {
|
response.results = response.results.reduce((acc, file) => {
|
||||||
if (file.icon === "loading") {
|
if (file.icon === "loading") {
|
||||||
cache.remove(FILE_PATH, [currentBackend(), currentShare(), file.path], false);
|
cache.remove(FILE_PATH, [currentBackend(), currentShare(), Path.join(currentPath, "../")], false);
|
||||||
cache.remove(FILE_CONTENT, [currentBackend(), currentShare(), file.path], false);
|
cache.remove(FILE_CONTENT, [currentBackend(), currentShare(), Path.join(currentPath, "../")], false);
|
||||||
|
cache.remove(FILE_TAG, [currentBackend(), currentShare(), Path.join(currentPath, "../")], false);
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
acc.push(file);
|
acc.push(file);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue