The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
perf(planner): load the tab panels on demand (#1816)
Maurice1d94814b571a
diff --git a/client/src/components/Budget/CostsPanel.helpers.ts b/client/src/components/Budget/CostsPanel.helpers.tsindex ae297b9f8..8e5c94042 100644--- a/client/src/components/Budget/CostsPanel.helpers.ts+++ b/client/src/components/Budget/CostsPanel.helpers.ts@@ -51,3 +51,74 @@ export function rebalancePayers(free.forEach((id, i) => { next[id] = shares[i] ? shares[i].toFixed(2) : '' })return next}++/**+ * Split `total` equally across `members`, in whole cents.+ *+ * The remainder cent rotates with the item id rather than always landing on the+ * first member, so across several expenses the rounding evens out instead of+ * always favouring the same person.+ */+export function splitEqualShares(total: number, members: { user_id: number }[], itemId: number): Record<number, number> {+ const n = members.length+ if (n === 0) return {}++ const totalCents = Math.round(total * 100)+ const baseCents = Math.floor(totalCents / n)+ const remainder = totalCents % n++ const shares: Record<number, number> = {}+ const sortedMembers = [...members].sort((a, b) => a.user_id - b.user_id)+ const startIndex = itemId % n++ for (let i = 0; i < n; i++) {+ const member = sortedMembers[i]+ const hasExtraCent = ((i - startIndex + n) % n) < remainder+ shares[member.user_id] = (baseCents + (hasExtraCent ? 1 : 0)) / 100+ }++ return shares+}++/** One line of a receipt: what it cost and who is in on it. */+export interface TicketItem {+ id: string+ name: string+ price: string+ participants: Set<number>+}++/** Per-person totals for a receipt split line by line, plus the receipt total. */+export function calculateTicketShares(items: TicketItem[]): { shares: Record<number, number>; total: number } {+ const shares: Record<number, number> = {}+ let totalCents = 0++ for (const item of items) {+ const priceNum = parseFloat(item.price) || 0+ const priceCents = Math.round(priceNum * 100)+ totalCents += priceCents++ const partIds = [...item.participants]+ const n = partIds.length+ if (n === 0) continue++ const baseCents = Math.floor(priceCents / n)+ const remainder = priceCents % n++ const sortedPartIds = [...partIds].sort((a, b) => a - b)++ for (let i = 0; i < n; i++) {+ const id = sortedPartIds[i]+ const hasExtraCent = i < remainder+ const shareCents = baseCents + (hasExtraCent ? 1 : 0)+ shares[id] = (shares[id] || 0) + shareCents+ }+ }++ const finalShares: Record<number, number> = {}+ for (const id of Object.keys(shares)) {+ finalShares[Number(id)] = shares[Number(id)] / 100+ }++ return { shares: finalShares, total: totalCents / 100 }+}diff --git a/client/src/components/Budget/CostsPanel.test.tsx b/client/src/components/Budget/CostsPanel.test.tsxindex 578c6d0e1..6e42b259c 100644--- a/client/src/components/Budget/CostsPanel.test.tsx+++ b/client/src/components/Budget/CostsPanel.test.tsx@@ -12,7 +12,8 @@ import { clearExchangeRateCache } from '../../hooks/useExchangeRates'import { resetAllStores, seedStore } from '../../../tests/helpers/store'import { buildUser, buildTrip, buildBudgetItem } from '../../../tests/helpers/factories'import type { BudgetItem } from '../../types'-import CostsPanel, { ExpenseModal, splitEqualShares, calculateTicketShares, type TicketItem } from './CostsPanel'+import CostsPanel, { ExpenseModal } from './CostsPanel'+import { splitEqualShares, calculateTicketShares, type TicketItem } from './CostsPanel.helpers'const tripMembers = [{ id: 1, username: 'alice', avatar_url: null },diff --git a/client/src/components/Budget/CostsPanel.tsx b/client/src/components/Budget/CostsPanel.tsxindex e9262393f..d4440824e 100644--- a/client/src/components/Budget/CostsPanel.tsx+++ b/client/src/components/Budget/CostsPanel.tsx@@ -16,7 +16,7 @@ import Modal from '../shared/Modal'import CustomSelect from '../shared/CustomSelect'import { CustomDatePicker } from '../shared/CustomDateTimePicker'import { SYMBOLS, currenciesWith, SPLIT_COLORS } from './BudgetPanel.constants'-import { payersBalanced, rebalancePayers } from './CostsPanel.helpers'+import { calculateTicketShares, payersBalanced, rebalancePayers, splitEqualShares, type TicketItem } from './CostsPanel.helpers'import { COST_CATEGORY_LIST, catMeta } from './costsCategories'import type { BudgetItem } from '../../types'import type { TripMember } from './BudgetPanelMemberChips'@@ -24,68 +24,6 @@ import GuestBadge from '../shared/GuestBadge'import { NumericInput } from '../shared/NumericInput'import EmptyState from '../shared/EmptyState'-export function splitEqualShares(total: number, members: { user_id: number }[], itemId: number): Record<number, number> {- const n = members.length- if (n === 0) return {}-- const totalCents = Math.round(total * 100)- const baseCents = Math.floor(totalCents / n)- const remainder = totalCents % n-- const shares: Record<number, number> = {}- const sortedMembers = [...members].sort((a, b) => a.user_id - b.user_id)- const startIndex = itemId % n-- for (let i = 0; i < n; i++) {- const member = sortedMembers[i]- const hasExtraCent = ((i - startIndex + n) % n) < remainder- shares[member.user_id] = (baseCents + (hasExtraCent ? 1 : 0)) / 100- }-- return shares-}--export interface TicketItem {- id: string- name: string- price: string- participants: Set<number>-}--export function calculateTicketShares(items: TicketItem[]): { shares: Record<number, number>; total: number } {- const shares: Record<number, number> = {}- let totalCents = 0-- for (const item of items) {- const priceNum = parseFloat(item.price) || 0- const priceCents = Math.round(priceNum * 100)- totalCents += priceCents-- const partIds = [...item.participants]- const n = partIds.length- if (n === 0) continue-- const baseCents = Math.floor(priceCents / n)- const remainder = priceCents % n-- const sortedPartIds = [...partIds].sort((a, b) => a - b)-- for (let i = 0; i < n; i++) {- const id = sortedPartIds[i]- const hasExtraCent = i < remainder- const shareCents = baseCents + (hasExtraCent ? 1 : 0)- shares[id] = (shares[id] || 0) + shareCents- }- }-- const finalShares: Record<number, number> = {}- for (const id of Object.keys(shares)) {- finalShares[Number(id)] = shares[Number(id)] / 100- }-- return { shares: finalShares, total: totalCents / 100 }-}-interface CostsPanelProps {tripId: numbertripMembers?: TripMember[]diff --git a/client/src/mobile/screens/trip/sheets/MCostSheet.tsx b/client/src/mobile/screens/trip/sheets/MCostSheet.tsxindex d8281e903..7ff04874e 100644--- a/client/src/mobile/screens/trip/sheets/MCostSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MCostSheet.tsx@@ -12,7 +12,8 @@ import { useExchangeRates } from '../../../../hooks/useExchangeRates'import { formatMoney, localizeAmountInput } from '../../../../utils/formatters'import { SYMBOLS, SPLIT_COLORS, currenciesWith } from '../../../../components/Budget/BudgetPanel.constants'import { COST_CATEGORY_LIST, catMeta } from '../../../../components/Budget/costsCategories'-import { calculateTicketShares, splitEqualShares, type TicketItem, type ExpensePrefill } from '../../../../components/Budget/CostsPanel'+import { calculateTicketShares, splitEqualShares, type TicketItem } from '../../../../components/Budget/CostsPanel.helpers'+import type { ExpensePrefill } from '../../../../components/Budget/CostsPanel'import { payersBalanced, rebalancePayers } from '../../../../components/Budget/CostsPanel.helpers'import GuestBadge from '../../../../components/shared/GuestBadge'import type { TripMember } from '../../../../components/Budget/BudgetPanelMemberChips'diff --git a/client/src/mobile/screens/trip/tabs/costsModel.ts b/client/src/mobile/screens/trip/tabs/costsModel.tsindex aca0d27d9..c43dfba21 100644--- a/client/src/mobile/screens/trip/tabs/costsModel.ts+++ b/client/src/mobile/screens/trip/tabs/costsModel.ts@@ -1,5 +1,5 @@import type { CostCategory } from '@trek/shared'-import { splitEqualShares } from '../../../../components/Budget/CostsPanel'+import { splitEqualShares } from '../../../../components/Budget/CostsPanel.helpers'import { catMeta, COST_CATEGORY_LIST } from '../../../../components/Budget/costsCategories'import { currencyDecimals } from '../../../../utils/formatters'import type { BudgetItem } from '../../../../types'diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsxindex bc4956678..6cb68251b 100644--- a/client/src/pages/TripPlannerPage.tsx+++ b/client/src/pages/TripPlannerPage.tsx@@ -1,4 +1,4 @@-import React, { useState } from 'react'+import React, { useState, Suspense } from 'react'import ReactDOM from 'react-dom'import { useParams, useNavigate, useSearchParams } from 'react-router'import { useTripStore } from '../store/tripStore'@@ -22,16 +22,13 @@ import TransitJourneyModal from '../components/Planner/TransitJourneyModal'import BookingImportModal from '../components/Planner/BookingImportModal'import AirTrailImportModal from '../components/Planner/AirTrailImportModal'// MemoriesPanel moved to Journey addon-import ReservationsPanel from '../components/Planner/ReservationsPanel'-import PackingListPanel from '../components/Packing/PackingListPanel'import ApplyTemplateButton from '../components/Packing/ApplyTemplateButton'-import TodoListPanel from '../components/Todo/TodoListPanel'-import FileManager from '../components/Files/FileManager'-import CostsPanel, { ExpenseModal, type ExpensePrefill } from '../components/Budget/CostsPanel'+import type { ExpensePrefill } from '../components/Budget/CostsPanel'import type { BookingExpenseRequest } from '../components/Planner/BookingCostsSection.types'import type { BudgetItem } from '../types'-import CollabPanel from '../components/Collab/CollabPanel'import PluginFrame from '../components/Plugins/PluginFrame'+import ErrorBoundary from '../components/shared/ErrorBoundary'+import { lazyWithRetry } from '../utils/lazyWithRetry'import TripWarningsBanner from '../components/Planner/TripWarningsBanner'import Navbar from '../components/Layout/Navbar'import { useToast } from '../components/shared/Toast'@@ -55,6 +52,46 @@ import { useIsPhone } from '../mobile/useIsPhone'import { useTouchDragBridge } from '../hooks/useTouchDragBridge'import MTripShell from '../mobile/screens/trip/MTripShell'+// The tab panels are the planner's dead weight: each one mounts only while its+// own tab is active, so the page chunk carried code most sessions never run. They+// load on demand now, through the same lazyWithRetry the route chunks use.+//+// PluginFrame stays static on purpose: DayDetailPanel and PlaceInspector import it+// too and both belong to the plan tab, so splitting it here would move nothing.+const ReservationsPanel = lazyWithRetry(() => import('../components/Planner/ReservationsPanel'))+const PackingListPanel = lazyWithRetry(() => import('../components/Packing/PackingListPanel'))+const TodoListPanel = lazyWithRetry(() => import('../components/Todo/TodoListPanel'))+const FileManager = lazyWithRetry(() => import('../components/Files/FileManager'))+const CostsPanel = lazyWithRetry(() => import('../components/Budget/CostsPanel'))+// Named export, so it needs the extra hop. Importing it statically would keep the+// whole CostsPanel module in the page chunk and undo the split above.+const ExpenseModal = lazyWithRetry(() =>+ import('../components/Budget/CostsPanel').then(m => ({ default: m.ExpenseModal }))+)+const CollabPanel = lazyWithRetry(() => import('../components/Collab/CollabPanel'))++/**+ * One tab panel, with its own net.+ *+ * The boundary sits outside the Suspense, not inside: Suspense owns the pending+ * promise, a rejected one throws straight past it. And it has to be per panel —+ * a single boundary around the whole content area would already be mounted with+ * the visible tab, so switching tabs would swap the entire planner for the+ * placeholder instead of just the part that is still loading.+ *+ * No label: ErrorBoundary lets label win over the panel level and would title a+ * broken packing list "This plugin could not be shown".+ */+function LazyPanel({ id, children }: { id: string; children: React.ReactNode }): React.ReactElement {+ return (+ <ErrorBoundary boundaryId={`planner-panel:${id}`}>+ <Suspense fallback={<div className="h-full w-full min-h-[180px] rounded-xl bg-surface-secondary animate-pulse" />}>+ {children}+ </Suspense>+ </ErrorBoundary>+ )+}+function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; packingItems: PackingItem[]; todoItems: TodoItem[] }) {const [subTab, setSubTab] = useState<'packing' | 'todo'>(() => {return (sessionStorage.getItem(`trip-lists-subtab-${tripId}`) as 'packing' | 'todo') || 'packing'@@ -173,8 +210,16 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p</div></div><div style={{ padding: '16px 28px 0' }} className="max-md:!px-4">- {subTab === 'packing' && <PackingListPanel tripId={tripId} items={packingItems} openImportSignal={importPackingSignal} clearCheckedSignal={clearCheckedSignal} saveTemplateSignal={saveTemplateSignal} inlineHeader={false} view={packingView} onViewChange={setPackingView} />}- {subTab === 'todo' && <TodoListPanel tripId={tripId} items={todoItems} addItemSignal={addTodoSignal} />}+ {subTab === 'packing' && (+ <LazyPanel id="packing">+ <PackingListPanel tripId={tripId} items={packingItems} openImportSignal={importPackingSignal} clearCheckedSignal={clearCheckedSignal} saveTemplateSignal={saveTemplateSignal} inlineHeader={false} view={packingView} onViewChange={setPackingView} />+ </LazyPanel>+ )}+ {subTab === 'todo' && (+ <LazyPanel id="todo">+ <TodoListPanel tripId={tripId} items={todoItems} addItemSignal={addTodoSignal} />+ </LazyPanel>+ )}</div></div>)@@ -650,44 +695,48 @@ function TripPlannerPageDesktop(): React.ReactElement | null {{activeTab === 'transports' && (<div style={{ height: '100%', width: '100%', display: 'flex', flexDirection: 'column', overflowY: 'auto', overscrollBehavior: 'contain', paddingBottom: 'var(--bottom-nav-h)' }}>- <ReservationsPanel- tripId={tripId}- reservations={reservations.filter(r => TRANSPORT_TYPES.has(r.type))}- days={days}- assignments={assignments}- files={files}- onAdd={() => { setEditingTransport(null); setTransitPrefill(null); setTransportModalAutomated(false); setShowTransportModal(true) }}- onImport={() => setShowBookingImport(true)}- bookingImportAvailable={bookingImportAvailable}- onAirTrailImport={() => setShowAirTrailImport(true)}- airTrailAvailable={airTrailAvailable}- onEdit={(r) => { if (r.type === 'transit') { setTransitJourney(r) } else { setEditingTransport(r); setTransportModalAutomated(false); setShowTransportModal(true) } }}- onDelete={handleDeleteReservation}- onNavigateToFiles={() => handleTabChange('dateien')}- titleKey="transport.title"- addManualKey="transport.addManual"- contributionView="transports"- tripMembers={tripMembers}- />+ <LazyPanel id="transports">+ <ReservationsPanel+ tripId={tripId}+ reservations={reservations.filter(r => TRANSPORT_TYPES.has(r.type))}+ days={days}+ assignments={assignments}+ files={files}+ onAdd={() => { setEditingTransport(null); setTransitPrefill(null); setTransportModalAutomated(false); setShowTransportModal(true) }}+ onImport={() => setShowBookingImport(true)}+ bookingImportAvailable={bookingImportAvailable}+ onAirTrailImport={() => setShowAirTrailImport(true)}+ airTrailAvailable={airTrailAvailable}+ onEdit={(r) => { if (r.type === 'transit') { setTransitJourney(r) } else { setEditingTransport(r); setTransportModalAutomated(false); setShowTransportModal(true) } }}+ onDelete={handleDeleteReservation}+ onNavigateToFiles={() => handleTabChange('dateien')}+ titleKey="transport.title"+ addManualKey="transport.addManual"+ contributionView="transports"+ tripMembers={tripMembers}+ />+ </LazyPanel></div>)}{activeTab === 'buchungen' && (<div style={{ height: '100%', width: '100%', display: 'flex', flexDirection: 'column', overflowY: 'auto', overscrollBehavior: 'contain', paddingBottom: 'var(--bottom-nav-h)' }}>- <ReservationsPanel- tripId={tripId}- reservations={reservations.filter(r => !TRANSPORT_TYPES.has(r.type))}- days={days}- assignments={assignments}- files={files}- onAdd={() => { setEditingReservation(null); setShowReservationModal(true) }}- onImport={() => setShowBookingImport(true)}- bookingImportAvailable={bookingImportAvailable}- onEdit={(r) => { setEditingReservation(r); setShowReservationModal(true) }}- onDelete={handleDeleteReservation}- onNavigateToFiles={() => handleTabChange('dateien')}- tripMembers={tripMembers}- />+ <LazyPanel id="buchungen">+ <ReservationsPanel+ tripId={tripId}+ reservations={reservations.filter(r => !TRANSPORT_TYPES.has(r.type))}+ days={days}+ assignments={assignments}+ files={files}+ onAdd={() => { setEditingReservation(null); setShowReservationModal(true) }}+ onImport={() => setShowBookingImport(true)}+ bookingImportAvailable={bookingImportAvailable}+ onEdit={(r) => { setEditingReservation(r); setShowReservationModal(true) }}+ onDelete={handleDeleteReservation}+ onNavigateToFiles={() => handleTabChange('dateien')}+ tripMembers={tripMembers}+ />+ </LazyPanel></div>)}@@ -699,30 +748,36 @@ function TripPlannerPageDesktop(): React.ReactElement | null {{activeTab === 'finanzplan' && (<div style={{ height: '100%', overflowY: 'auto', overscrollBehavior: 'contain', width: '100%', paddingBottom: 'var(--bottom-nav-h)' }}>- <CostsPanel tripId={tripId} tripMembers={tripMembers} />+ <LazyPanel id="finanzplan">+ <CostsPanel tripId={tripId} tripMembers={tripMembers} />+ </LazyPanel></div>)}{activeTab === 'dateien' && (<div style={{ height: '100%', overflow: 'hidden', overscrollBehavior: 'contain', paddingBottom: 'var(--bottom-nav-h)' }}>- <FileManager- files={files || []}- onUpload={(fd) => tripActions.addFile(tripId, fd)}- onDelete={(id) => tripActions.deleteFile(tripId, id)}- onUpdate={() => tripActions.loadFiles(tripId)}- places={places}- days={days}- assignments={assignments}- reservations={reservations}- tripId={tripId}- allowedFileTypes={allowedFileTypes}- />+ <LazyPanel id="dateien">+ <FileManager+ files={files || []}+ onUpload={(fd) => tripActions.addFile(tripId, fd)}+ onDelete={(id) => tripActions.deleteFile(tripId, id)}+ onUpdate={() => tripActions.loadFiles(tripId)}+ places={places}+ days={days}+ assignments={assignments}+ reservations={reservations}+ tripId={tripId}+ allowedFileTypes={allowedFileTypes}+ />+ </LazyPanel></div>)}{activeTab === 'collab' && (<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 'var(--bottom-nav-h)', overflow: 'hidden' }}>- <CollabPanel tripId={tripId} tripMembers={tripMembers} collabFeatures={collabFeatures} />+ <LazyPanel id="collab">+ <CollabPanel tripId={tripId} tripMembers={tripMembers} collabFeatures={collabFeatures} />+ </LazyPanel></div>)}@@ -772,16 +827,20 @@ function TripPlannerPageDesktop(): React.ReactElement | null {/>)}{bookingExpense && (- <ExpenseModal- tripId={tripId}- base={costsBase}- people={tripMembers}- me={meId}- editing={bookingExpense.editing}- prefill={bookingExpense.prefill}- onClose={() => setBookingExpense(null)}- onSaved={() => { setBookingExpense(null); loadBudgetItems(tripId) }}- />+ <ErrorBoundary boundaryId="planner-panel:expense" fallback={null}>+ <Suspense fallback={null}>+ <ExpenseModal+ tripId={tripId}+ base={costsBase}+ people={tripMembers}+ me={meId}+ editing={bookingExpense.editing}+ prefill={bookingExpense.prefill}+ onClose={() => setBookingExpense(null)}+ onSaved={() => { setBookingExpense(null); loadBudgetItems(tripId) }}+ />+ </Suspense>+ </ErrorBoundary>)}<BookingImportModal isOpen={showBookingImport} onClose={() => setShowBookingImport(false)} tripId={tripId} /><AirTrailImportModal isOpen={showAirTrailImport} onClose={() => setShowAirTrailImport(false)} tripId={tripId} pushUndo={pushUndo} />diff --git a/client/src/pages/TripPlannerPage.wiring.test.tsx b/client/src/pages/TripPlannerPage.wiring.test.tsxindex e6db18098..be0dc2e9c 100644--- a/client/src/pages/TripPlannerPage.wiring.test.tsx+++ b/client/src/pages/TripPlannerPage.wiring.test.tsx@@ -813,8 +813,10 @@ describe('TripPlannerPage — other tabs', () => {const hotel = buildReservation({ id: 2, type: 'hotel' })const transit = buildReservation({ id: 3, type: 'train' })- it('FE-PAGE-TPW-034: the transports tab lists only transport bookings and wires its actions', () => {+ it('FE-PAGE-TPW-034: the transports tab lists only transport bookings and wires its actions', async () => {renderPage({ activeTab: 'transports', reservations: [flight, hotel, transit] })+ // The panel loads on demand now; its props only exist once the chunk is in.+ await screen.findByTestId('reservations-panel')const listed = props('reservationsPanel').reservations as unknown as Reservation[]expect(listed.map(r => r.id)).toEqual([1, 3])@@ -838,17 +840,19 @@ describe('TripPlannerPage — other tabs', () => {expect(hookState.handleTabChange).toHaveBeenCalledWith('dateien')})- it('FE-PAGE-TPW-035: a saved transit journey opens the journey view instead of the editor', () => {+ it('FE-PAGE-TPW-035: a saved transit journey opens the journey view instead of the editor', async () => {const journey = buildReservation({ id: 9, type: 'transit' })renderPage({ activeTab: 'transports', reservations: [journey] })+ await screen.findByTestId('reservations-panel')act(() => { props('reservationsPanel').onEdit(journey) })expect(hookState.setTransitJourney).toHaveBeenCalledWith(journey)expect(hookState.setShowTransportModal).not.toHaveBeenCalled()})- it('FE-PAGE-TPW-036: the bookings tab lists everything that is not transport', () => {+ it('FE-PAGE-TPW-036: the bookings tab lists everything that is not transport', async () => {renderPage({ activeTab: 'buchungen', reservations: [flight, hotel] })+ await screen.findByTestId('reservations-panel')const listed = props('reservationsPanel').reservations as unknown as Reservation[]expect(listed.map(r => r.id)).toEqual([2])@@ -866,15 +870,17 @@ describe('TripPlannerPage — other tabs', () => {expect(hookState.handleTabChange).toHaveBeenCalledWith('dateien')})- it('FE-PAGE-TPW-037: the costs, collab and plugin tabs mount their panel', () => {+ it('FE-PAGE-TPW-037: the costs, collab and plugin tabs mount their panel', async () => {renderPage({ activeTab: 'finanzplan' })- expect(screen.getByTestId('costs-panel')).toBeInTheDocument()+ expect(await screen.findByTestId('costs-panel')).toBeInTheDocument()cleanup()renderPage({ activeTab: 'collab' })- expect(screen.getByTestId('collab-panel')).toBeInTheDocument()+ expect(await screen.findByTestId('collab-panel')).toBeInTheDocument()cleanup()+ // PluginFrame is deliberately not lazy — DayDetailPanel and PlaceInspector+ // pull it in from the plan tab anyway — so this stays synchronous.renderPage({ activeTab: 'plugin:routes' })expect(props('pluginFrame').pluginId).toBe('routes')expect(props('pluginFrame').tripId).toBe('42')@@ -882,6 +888,7 @@ describe('TripPlannerPage — other tabs', () => {it('FE-PAGE-TPW-038: the files tab hands the manager the trip files and the write callbacks', async () => {renderPage({ activeTab: 'dateien', files: [] })+ await screen.findByTestId('file-manager')expect(props('fileManager').allowedFileTypes).toBe('pdf')@@ -897,51 +904,55 @@ describe('TripPlannerPage — other tabs', () => {})describe('TripPlannerPage — lists tab', () => {- it('FE-PAGE-TPW-039: the lists tab starts on packing and remembers the chosen subtab', () => {+ it('FE-PAGE-TPW-039: the lists tab starts on packing and remembers the chosen subtab', async () => {renderPage({ activeTab: 'listen', packingItems: [buildPackingItem({ checked: 0 })], todoItems: [buildTodoItem()] })- expect(screen.getByTestId('packing-list-panel')).toBeInTheDocument()+ expect(await screen.findByTestId('packing-list-panel')).toBeInTheDocument()fireEvent.click(screen.getByText('To-Do'))- expect(screen.getByTestId('todo-list-panel')).toBeInTheDocument()+ expect(await screen.findByTestId('todo-list-panel')).toBeInTheDocument()expect(sessionStorage.getItem('trip-lists-subtab-42')).toBe('todo')})- it('FE-PAGE-TPW-040: a persisted subtab wins over the packing default', () => {+ it('FE-PAGE-TPW-040: a persisted subtab wins over the packing default', async () => {sessionStorage.setItem('trip-lists-subtab-42', 'todo')renderPage({ activeTab: 'listen' })- expect(screen.getByTestId('todo-list-panel')).toBeInTheDocument()+ expect(await screen.findByTestId('todo-list-panel')).toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: /Add new task/i }))expect(props('todoPanel').addItemSignal).toBe(1)})- it('FE-PAGE-TPW-041: the clear-checked action only appears once something is checked', () => {+ it('FE-PAGE-TPW-041: the clear-checked action only appears once something is checked', async () => {renderPage({ activeTab: 'listen', packingItems: [buildPackingItem({ checked: 1 })] })+ await screen.findByTestId('packing-list-panel')const clear = screen.getByRole('button', { name: /Remove 1 checked/i })fireEvent.click(clear)expect(props('packingPanel').clearCheckedSignal).toBe(1)})- it('FE-PAGE-TPW-042: an admin can save the current list as a template', () => {+ it('FE-PAGE-TPW-042: an admin can save the current list as a template', async () => {seedStore(useAuthStore, { user: buildUser({ id: 5, role: 'admin' }) })renderPage({ activeTab: 'listen', packingItems: [buildPackingItem({ checked: 0 })] })+ await screen.findByTestId('packing-list-panel')fireEvent.click(screen.getByRole('button', { name: /Save as template/i }))expect(props('packingPanel').saveTemplateSignal).toBe(1)})- it('FE-PAGE-TPW-043: a non-admin sees import but no save-as-template', () => {+ it('FE-PAGE-TPW-043: a non-admin sees import but no save-as-template', async () => {renderPage({ activeTab: 'listen', packingItems: [buildPackingItem({ checked: 0 })] })+ await screen.findByTestId('packing-list-panel')expect(screen.queryByRole('button', { name: /Save as template/i })).not.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: /Import/i }))expect(props('packingPanel').openImportSignal).toBe(1)})- it('FE-PAGE-TPW-044: switching the packing visibility is forwarded to the template button', () => {+ it('FE-PAGE-TPW-044: switching the packing visibility is forwarded to the template button', async () => {renderPage({ activeTab: 'listen', packingItems: [] })+ await screen.findByTestId('packing-list-panel')expect(props('applyTemplate').visibility).toBe('common')act(() => { props('packingPanel').onViewChange('personal') })