fix(#20): Open-order (listed/unlisted) state never refreshes in the acquisitions view
This commit is contained in:
@@ -3,8 +3,8 @@ import {SliderCheckbox} from '@/components';
|
|||||||
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
|
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
|
||||||
import {getListedSellTypeIds, MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market";
|
import {getListedSellTypeIds, MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market";
|
||||||
import {MinusIcon, PlusIcon} from '@heroicons/vue/24/outline';
|
import {MinusIcon, PlusIcon} from '@heroicons/vue/24/outline';
|
||||||
import {computedAsync, useStorage} from '@vueuse/core';
|
import {useStorage} from '@vueuse/core';
|
||||||
import {computed, ref} from 'vue';
|
import {computed, ref, watch} from 'vue';
|
||||||
import {AcquiredType} from './AcquiredType';
|
import {AcquiredType} from './AcquiredType';
|
||||||
import AcquisitionQuartilesTooltip from './AcquisitionQuartilesTooltip.vue';
|
import AcquisitionQuartilesTooltip from './AcquisitionQuartilesTooltip.vue';
|
||||||
import {formatEveDate, formatIsk, percentFormater} from "@/formaters.ts";
|
import {formatEveDate, formatIsk, percentFormater} from "@/formaters.ts";
|
||||||
@@ -67,7 +67,10 @@ const columnsToIgnore = computed(() => {
|
|||||||
const marketTaxStore = useMarketTaxStore();
|
const marketTaxStore = useMarketTaxStore();
|
||||||
const ledgersStore = useLedgersStore();
|
const ledgersStore = useLedgersStore();
|
||||||
|
|
||||||
const listedTypeIds = computedAsync(getListedSellTypeIds, new Set<number>());
|
const listedTypeIds = ref(new Set<number>());
|
||||||
|
watch(() => props.items, async () => {
|
||||||
|
listedTypeIds.value = await getListedSellTypeIds();
|
||||||
|
}, { immediate: true });
|
||||||
|
|
||||||
const threshold = useStorage('market-acquisition-threshold', 10);
|
const threshold = useStorage('market-acquisition-threshold', 10);
|
||||||
const filter = ref("");
|
const filter = ref("");
|
||||||
@@ -75,7 +78,7 @@ const unlistedOnly = ref(false);
|
|||||||
const matchesFilter = (r: AcquiredType) =>
|
const matchesFilter = (r: AcquiredType) =>
|
||||||
r.type.name.toLowerCase().includes(filter.value.toLowerCase())
|
r.type.name.toLowerCase().includes(filter.value.toLowerCase())
|
||||||
&& (!unlistedOnly.value || !listedTypeIds.value.has(r.type.id));
|
&& (!unlistedOnly.value || !listedTypeIds.value.has(r.type.id));
|
||||||
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => {
|
const results = computed<Result[]>(() => {
|
||||||
const filteredItems = props.items.filter(matchesFilter);
|
const filteredItems = props.items.filter(matchesFilter);
|
||||||
|
|
||||||
if (props.showAll) {
|
if (props.showAll) {
|
||||||
@@ -133,7 +136,8 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}), {
|
});
|
||||||
|
const { sortedArray, headerProps, showColumn } = useSort<Result>(results, {
|
||||||
defaultSortKey: props.defaultSortKey,
|
defaultSortKey: props.defaultSortKey,
|
||||||
defaultSortDirection: 'desc',
|
defaultSortDirection: 'desc',
|
||||||
ignoredColumns: columnsToIgnore
|
ignoredColumns: columnsToIgnore
|
||||||
|
|||||||
Reference in New Issue
Block a user