mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-08-15 00:10:44 +02:00
fix: dedupe folder contents on re-fetch (#701)
getFiles blindly appended fetched entries to $scope.files, so re-opening a folder duplicated its children in the tree. Drop any existing entries at the requested path before appending.
This commit is contained in:
@@ -2167,6 +2167,8 @@ angular
|
|||||||
const res = await $http.get(
|
const res = await $http.get(
|
||||||
`/api/repo/${$scope.repoId}/files/?path=${encodeURIComponent(path)}&v=${$scope.options.lastUpdateDate}`
|
`/api/repo/${$scope.repoId}/files/?path=${encodeURIComponent(path)}&v=${$scope.options.lastUpdateDate}`
|
||||||
);
|
);
|
||||||
|
const normalized = path || "";
|
||||||
|
$scope.files = $scope.files.filter((f) => f.path !== normalized);
|
||||||
$scope.files.push(...res.data);
|
$scope.files.push(...res.data);
|
||||||
return res.data;
|
return res.data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user