From 07881ac76a8b8ea1c4177f3517e7de5d55ccaa32 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Tue, 5 Aug 2025 16:29:08 +0200 Subject: [PATCH] Fix filter cache breaking interface Investigating people complaining develop.opencast.org being broken, it seems like there was a change to the filters which cannot handle the previous data which might still be stored in browsers. Like here means, it completely crashes the interface and users just see a blank page. The error they get is: ``` Uncaught TypeError: t.find is not a function fk tableFilterSelectors.ts:23 D reselect.mjs:647 i reselect.mjs:584 P reselect.mjs:659 i reselect.mjs:584 u TableFilters.tsx:55 Redux L use-sync-external-store-with-selector.production.js:40 h use-sync-external-store-with-selector.production.js:63 React 2 useSyncExternalStoreWithSelector use-sync-external-store-with-selector.production.js:74 n Redux qc TableFilters.tsx:55 React 14 K scheduler.production.js:152 tableFilterSelectors.ts:23:32 ``` This patch makes the code a bit more resilient so it can deal with the previous content. --- src/selectors/tableFilterSelectors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selectors/tableFilterSelectors.ts b/src/selectors/tableFilterSelectors.ts index 9b8cb366c3..07eae4c907 100644 --- a/src/selectors/tableFilterSelectors.ts +++ b/src/selectors/tableFilterSelectors.ts @@ -20,7 +20,7 @@ export const getFilters = createSelector( export const getTextFilter = createSelector( [getAllTextFilter, (state, resource: Resource) => resource], (textFilter, resource) => { - const textFilte = textFilter.find(obj => obj.resource === resource); + const textFilte = (textFilter || []).find(obj => obj.resource === resource); return textFilte?.text ?? ""; }, );