Merge pull request #4150 from mental32/persist-file-list-item-checkbox-detail

Persist FileListItem checkbox detail
This commit is contained in:
Kiril Videlov 2024-06-23 14:40:55 +02:00 committed by GitHub
commit 03a4078c60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,9 +30,19 @@
let checked = false;
let draggableElt: HTMLDivElement;
let lastCheckboxDetail = true;
$: if (!lastCheckboxDetail) {
selectedOwnership?.update((ownership) => {
file.hunks.forEach((h) => ownership.remove(file.id, h.id));
return ownership;
});
}
$: if (file && $selectedOwnership) {
checked = file.hunks.every((hunk) => $selectedOwnership?.contains(file.id, hunk.id));
checked =
file.hunks.every((hunk) => $selectedOwnership?.contains(file.id, hunk.id)) &&
lastCheckboxDetail;
}
$: if ($fileIdSelection && draggableElt)
@ -120,6 +130,7 @@
{checked}
on:change={(e) => {
const isChecked = e.detail;
lastCheckboxDetail = isChecked;
selectedOwnership?.update((ownership) => {
if (isChecked) {
file.hunks.forEach((h) => ownership.add(file.id, h));