fix bug where object list would not update

This commit is contained in:
marlon-erler
2024-07-14 20:08:01 +02:00
parent fb0ba72ab8
commit 8629bd5fc8
2 changed files with 11 additions and 7 deletions
+5 -3
View File
@@ -61,15 +61,17 @@ export function ObjectPane(chat: Chat) {
appliedFilter.value = filterInput.value;
}
appliedFilter.subscribe((filterTerm) => {
function updateObjects() {
const allObjects = [...chat.objects.value.entries()];
const matchingObjects = allObjects.filter(
(entry) => entry[1].title.indexOf(filterTerm) != -1
(entry) => entry[1].title.indexOf(appliedFilter.value) != -1
);
resultCount.value = matchingObjects.length;
messageObjects.clear();
matchingObjects.forEach((entry) => messageObjects.set(...entry));
});
}
React.bulkSubscribe([appliedFilter, chat.objects], updateObjects);
updateObjects();
// view
const objectModal = React.createProxyState(