fix bug where object list would not update
This commit is contained in:
Vendored
+6
-4
@@ -608,7 +608,7 @@
|
|||||||
showObjects: "mostrar objetos",
|
showObjects: "mostrar objetos",
|
||||||
createObject: "a\xF1adir nuevo objeto",
|
createObject: "a\xF1adir nuevo objeto",
|
||||||
untitledObject: "Sin T\xEDtulo",
|
untitledObject: "Sin T\xEDtulo",
|
||||||
filterObjects: "filtrar objetos",
|
filterObjects: "Filtrar objetos",
|
||||||
searchByTitle: "Buscar por t\xEDtulo",
|
searchByTitle: "Buscar por t\xEDtulo",
|
||||||
searchByTitlePlaceholder: "Mi Objeto",
|
searchByTitlePlaceholder: "Mi Objeto",
|
||||||
searchTitleText: (term, resultCount) => term == "" ? `Objetos en total: ${resultCount}` : `Resultados por "${term}": ${resultCount}`,
|
searchTitleText: (term, resultCount) => term == "" ? `Objetos en total: ${resultCount}` : `Resultados por "${term}": ${resultCount}`,
|
||||||
@@ -2093,15 +2093,17 @@
|
|||||||
function applyFilter() {
|
function applyFilter() {
|
||||||
appliedFilter.value = filterInput.value;
|
appliedFilter.value = filterInput.value;
|
||||||
}
|
}
|
||||||
appliedFilter.subscribe((filterTerm) => {
|
function updateObjects() {
|
||||||
const allObjects = [...chat.objects.value.entries()];
|
const allObjects = [...chat.objects.value.entries()];
|
||||||
const matchingObjects = allObjects.filter(
|
const matchingObjects = allObjects.filter(
|
||||||
(entry) => entry[1].title.indexOf(filterTerm) != -1
|
(entry) => entry[1].title.indexOf(appliedFilter.value) != -1
|
||||||
);
|
);
|
||||||
resultCount.value = matchingObjects.length;
|
resultCount.value = matchingObjects.length;
|
||||||
messageObjects.clear();
|
messageObjects.clear();
|
||||||
matchingObjects.forEach((entry) => messageObjects.set(...entry));
|
matchingObjects.forEach((entry) => messageObjects.set(...entry));
|
||||||
});
|
}
|
||||||
|
bulkSubscribe([appliedFilter, chat.objects], updateObjects);
|
||||||
|
updateObjects();
|
||||||
const objectModal = createProxyState(
|
const objectModal = createProxyState(
|
||||||
[chat.objects, selectedObject],
|
[chat.objects, selectedObject],
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -61,15 +61,17 @@ export function ObjectPane(chat: Chat) {
|
|||||||
appliedFilter.value = filterInput.value;
|
appliedFilter.value = filterInput.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
appliedFilter.subscribe((filterTerm) => {
|
function updateObjects() {
|
||||||
const allObjects = [...chat.objects.value.entries()];
|
const allObjects = [...chat.objects.value.entries()];
|
||||||
const matchingObjects = allObjects.filter(
|
const matchingObjects = allObjects.filter(
|
||||||
(entry) => entry[1].title.indexOf(filterTerm) != -1
|
(entry) => entry[1].title.indexOf(appliedFilter.value) != -1
|
||||||
);
|
);
|
||||||
resultCount.value = matchingObjects.length;
|
resultCount.value = matchingObjects.length;
|
||||||
messageObjects.clear();
|
messageObjects.clear();
|
||||||
matchingObjects.forEach((entry) => messageObjects.set(...entry));
|
matchingObjects.forEach((entry) => messageObjects.set(...entry));
|
||||||
});
|
}
|
||||||
|
React.bulkSubscribe([appliedFilter, chat.objects], updateObjects);
|
||||||
|
updateObjects();
|
||||||
|
|
||||||
// view
|
// view
|
||||||
const objectModal = React.createProxyState(
|
const objectModal = React.createProxyState(
|
||||||
|
|||||||
Reference in New Issue
Block a user