Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: table selection states not getting invailidated
Kyle Mendelld1ef3cb4a065
diff --git a/src/lib/components/universal-table.svelte b/src/lib/components/universal-table.svelteindex 3d28ada7d..1331f7ed7 100644--- a/src/lib/components/universal-table.svelte+++ b/src/lib/components/universal-table.svelte@@ -42,9 +42,19 @@let selectedRowIds = $state<Record<string, boolean>>({});$effect(() => {- selectedIds = Object.entries(selectedRowIds)- .filter(([_, selected]) => selected)- .map(([id]) => id);+ const newTanstackSelectionState: Record<string, boolean> = {};+ (selectedIds || []).forEach((id) => {+ newTanstackSelectionState[id] = true;+ });++ const currentTanstackSelectedKeys = Object.keys(selectedRowIds)+ .filter((k) => selectedRowIds[k])+ .sort();+ const newPropSelectedKeys = Object.keys(newTanstackSelectionState).sort();++ if (JSON.stringify(currentTanstackSelectedKeys) !== JSON.stringify(newPropSelectedKeys)) {+ table.setRowSelection(newTanstackSelectionState);+ }});$effect(() => {@@ -112,10 +122,21 @@currentPage = 1;},onRowSelectionChange: (updater) => {- if (typeof updater === 'function') {- selectedRowIds = updater(selectedRowIds);- } else {- selectedRowIds = updater;+ const newInternalState = typeof updater === 'function' ? updater(selectedRowIds) : updater;++ if (JSON.stringify(newInternalState) !== JSON.stringify(selectedRowIds)) {+ selectedRowIds = newInternalState;+ }++ const newSelectedIdsArray = Object.entries(selectedRowIds)+ .filter(([_, selected]) => selected)+ .map(([id]) => id);++ const sortedCurrentProp = [...(selectedIds || [])].sort();+ const sortedNewInternal = [...newSelectedIdsArray].sort();++ if (JSON.stringify(sortedCurrentProp) !== JSON.stringify(sortedNewInternal)) {+ selectedIds = newSelectedIdsArray;}},enableRowSelection: enableSelectiondiff --git a/src/routes/images/+page.server.ts b/src/routes/images/+page.server.tsindex 1d2cea1bf..c8a046791 100644--- a/src/routes/images/+page.server.ts+++ b/src/routes/images/+page.server.ts@@ -19,7 +19,6 @@ export const load: PageServerLoad = async (): Promise<ImageData> => {images.map(async (image): Promise<EnhancedImageInfo> => {const inUse = await isImageInUse(image.id);- // Add maturity check without modifying existing logiclet maturity = undefined;try {if (image.repo !== '<none>' && image.tag !== '<none>') {@@ -27,13 +26,12 @@ export const load: PageServerLoad = async (): Promise<ImageData> => {}} catch (maturityError) {console.error(`Failed to check maturity for image ${image.id}:`, maturityError);- // Don't let maturity errors affect the main flow}return {...image,inUse,- maturity // Add maturity info if available+ maturity};}));