diff --git a/dist/index.js b/dist/index.js index 574caec0..638300ea 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2533,17 +2533,24 @@ return viewBuilder(matchingObjects); } - // src/View/Components/propertyList.tsx + // src/View/Components/propertyValueList.tsx function PropertyValueList(propertyKey, stringEntryObjectConverter, objects, viewBuilder) { const propertyValues = new ListState(); function collectValues() { - propertyValues.clear(); const values = collectObjectValuesForKey( propertyKey, stringEntryObjectConverter, [...objects.value.values()] ); - propertyValues.add(...values); + for (const existingValue of values) { + if (propertyValues.value.has(existingValue)) continue; + propertyValues.add(existingValue); + } + for (const displayedValue of propertyValues.value.values()) { + if (values.includes(displayedValue) == false) { + propertyValues.remove(displayedValue); + } + } } objects.subscribe(() => { collectValues(); diff --git a/src/View/ChatPages/boardKanbanPage.tsx b/src/View/ChatPages/boardKanbanPage.tsx index ac3d019b..e7ab9d5b 100644 --- a/src/View/ChatPages/boardKanbanPage.tsx +++ b/src/View/ChatPages/boardKanbanPage.tsx @@ -2,7 +2,7 @@ import * as React from "bloatless-react"; import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import { FilteredList } from "../Components/filteredList"; -import { PropertyValueList } from "../Components/propertyList"; +import { PropertyValueList } from "../Components/propertyValueList"; import { TaskCategoryBulkChangeViewModel } from "../../ViewModel/Utility/taskPropertyBulkChangeViewModel"; import TaskViewModel from "../../ViewModel/Pages/taskViewModel"; import { TaskViewModelToEntry } from "../Components/taskEntry"; diff --git a/src/View/ChatPages/boardStatusGridPage.tsx b/src/View/ChatPages/boardStatusGridPage.tsx index c55d9954..515d087e 100644 --- a/src/View/ChatPages/boardStatusGridPage.tsx +++ b/src/View/ChatPages/boardStatusGridPage.tsx @@ -7,7 +7,7 @@ import { import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import { FilteredList } from "../Components/filteredList"; -import { PropertyValueList } from "../Components/propertyList"; +import { PropertyValueList } from "../Components/propertyValueList"; import TaskViewModel from "../../ViewModel/Pages/taskViewModel"; import { TaskViewModelToEntry } from "../Components/taskEntry"; import { allowDrop } from "../utility"; diff --git a/src/View/Components/propertyList.tsx b/src/View/Components/propertyValueList.tsx similarity index 68% rename from src/View/Components/propertyList.tsx rename to src/View/Components/propertyValueList.tsx index b5551d43..b36fa38a 100644 --- a/src/View/Components/propertyList.tsx +++ b/src/View/Components/propertyValueList.tsx @@ -14,13 +14,21 @@ export function PropertyValueList( const propertyValues: React.ListState = new React.ListState(); function collectValues() { - propertyValues.clear(); const values: string[] = collectObjectValuesForKey( propertyKey, stringEntryObjectConverter, [...objects.value.values()] ); - propertyValues.add(...values); + for (const existingValue of values) { + if (propertyValues.value.has(existingValue)) continue; + propertyValues.add(existingValue); + } + + for (const displayedValue of propertyValues.value.values()) { + if (values.includes(displayedValue) == false) { + propertyValues.remove(displayedValue); + } + } } objects.subscribe(() => {