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
+6 -4
View File
@@ -608,7 +608,7 @@
showObjects: "mostrar objetos",
createObject: "a\xF1adir nuevo objeto",
untitledObject: "Sin T\xEDtulo",
filterObjects: "filtrar objetos",
filterObjects: "Filtrar objetos",
searchByTitle: "Buscar por t\xEDtulo",
searchByTitlePlaceholder: "Mi Objeto",
searchTitleText: (term, resultCount) => term == "" ? `Objetos en total: ${resultCount}` : `Resultados por "${term}": ${resultCount}`,
@@ -2093,15 +2093,17 @@
function applyFilter() {
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));
});
}
bulkSubscribe([appliedFilter, chat.objects], updateObjects);
updateObjects();
const objectModal = createProxyState(
[chat.objects, selectedObject],
() => {
+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(