From ca2c1c91839fb5b520cb98a308c8c5751aa4c7a1 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Wed, 21 Jan 2026 18:16:15 +0100 Subject: [PATCH 1/2] fix: details not syncing with startDetails and dup. entries --- src/contexts/paging/PagingGenerator.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/contexts/paging/PagingGenerator.tsx b/src/contexts/paging/PagingGenerator.tsx index 327f3071a..793d8854b 100644 --- a/src/contexts/paging/PagingGenerator.tsx +++ b/src/contexts/paging/PagingGenerator.tsx @@ -111,10 +111,15 @@ export function generatePaging { handleDetailsChange() - }, [details, startDetails]) + }, [details]) + + useEffect(() => { + setDetails(startDetails) + }, [startDetails]) const loadMore = useCallback(async () => { if (state.allLoaded) return [] + if (loading) return [] setLoading(true) const data = await fetcher({ paging: { @@ -141,7 +146,7 @@ export function generatePaging { const toPage = state.page.page From a02d6e58a0262a05e1c2f9f690c6f39098b8fb34 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Wed, 21 Jan 2026 18:52:03 +0100 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20move=20back=20to=20id=20keys=C2=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint.config.ts | 1 + .../Company/CompanyListRenderer.tsx | 3 +- src/app/_components/NavBar/navDef.ts | 3 -- .../PagingWrappers/EndlessScroll.tsx | 32 +++++++++++++------ .../_components/User/UserList/UserList.tsx | 3 +- .../countdown/CommitteeLogoRoll.tsx | 2 +- src/hooks/useDebounce.ts | 22 +++++++++---- .../seeder/src/seedNotificationsChannels.ts | 3 +- src/services/shop/shop/operations.ts | 6 ++-- 9 files changed, 46 insertions(+), 29 deletions(-) diff --git a/eslint.config.ts b/eslint.config.ts index 78938a75e..59f117624 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -357,6 +357,7 @@ const eslintConfig = defineConfig([ 'no-sequences': 'error', // disallow usage of expressions in statement position 'no-unused-expressions': 'error', + '@typescript-eslint/no-unused-vars': 'error', // disallow unused labels 'no-unused-labels': 'error', // disallow usage of configurable warning terms in comments: e.g. todo diff --git a/src/app/_components/Company/CompanyListRenderer.tsx b/src/app/_components/Company/CompanyListRenderer.tsx index 70f39b9eb..7096aef7b 100644 --- a/src/app/_components/Company/CompanyListRenderer.tsx +++ b/src/app/_components/Company/CompanyListRenderer.tsx @@ -1,7 +1,6 @@ import Company from './Company' import type { SessionMaybeUser } from '@/auth/session/Session' import type { CompanyExpanded } from '@/services/career/companies/types' -import { v4 } from 'uuid' /** * Used to render schools server side and client side in consistent way @@ -19,4 +18,4 @@ export const companyListRenderer = ({ disableEditing?: boolean // eslint-disable-next-line react/display-name }) => (company: CompanyExpanded) => - + diff --git a/src/app/_components/NavBar/navDef.ts b/src/app/_components/NavBar/navDef.ts index e06e5e9a2..9fc977755 100644 --- a/src/app/_components/NavBar/navDef.ts +++ b/src/app/_components/NavBar/navDef.ts @@ -4,8 +4,6 @@ import { faGamepad, faBook, - faPoo, - faShoppingCart, faComment, faCamera, faCircleInfo, @@ -17,7 +15,6 @@ import { faBriefcase, faGraduationCap, faTools, - faChartLine, faSignature, faSchool, faHouseChimneyWindow, diff --git a/src/app/_components/PagingWrappers/EndlessScroll.tsx b/src/app/_components/PagingWrappers/EndlessScroll.tsx index a5fe6f6ae..343fdf85e 100644 --- a/src/app/_components/PagingWrappers/EndlessScroll.tsx +++ b/src/app/_components/PagingWrappers/EndlessScroll.tsx @@ -28,19 +28,21 @@ export default function EndlessScroll { - if (context.state.allLoaded) return + const loadMoreCallback = useCallback(async () => { if (!inView) return - await context.loadMore() - }, [context, inView]) + await loadMore() + }, [loadMore, inView]) useEffect(() => { - loadMore() - }, [inView, loadMore]) + loadMoreCallback() + }, [inView, loadMoreCallback]) const renderedPageData = useMemo(() => context.state.data.map((dataEntry, i) => { @@ -67,14 +69,26 @@ export default function EndlessScroll { if (timerRef.current) clearTimeout(timerRef.current) } - }, [context.state.allLoaded]) + }, [state]) return ( <> {renderedPageData} - Ingen flere å laste inn - + { + loading ? ( + Laster inn flere... + ) : ( + <> + + Ingen flere å laste inn + + + + ) + } ) diff --git a/src/app/_components/User/UserList/UserList.tsx b/src/app/_components/User/UserList/UserList.tsx index 7112be8d2..264e1608a 100644 --- a/src/app/_components/User/UserList/UserList.tsx +++ b/src/app/_components/User/UserList/UserList.tsx @@ -10,7 +10,6 @@ import { UserSelectionContext } from '@/contexts/UserSelection' import { readGroupsForPageFilteringAction } from '@/services/users/actions' import { useContext, useEffect, useState } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { v4 } from 'uuid' import { faCheck } from '@fortawesome/free-solid-svg-icons' import type { UserPagingReturn } from '@/services/users/types' import type { ChangeEvent, ReactNode } from 'react' @@ -265,7 +264,7 @@ export default function UserList({ ( - + { usersSelection &&