mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
1d94814b57
* refactor(costs): move the pure split maths out of the panel module splitEqualShares, calculateTicketShares and TicketItem sit next to the payer maths they belong with. They are pure functions with no module state and no imports from the panel, so this is a move and nothing else. The reason it matters: the mobile cost sheet and its model import these two functions from CostsPanel, and MTripShell is a static import of the trip planner page. Any attempt to load the costs panel on demand would therefore pull the whole 97 kB module straight back in through the mobile branch. * perf(planner): load the tab panels on demand Each tab panel only mounts while its own tab is active, yet all six shipped in the planner chunk. The page was 1,203 kB after route splitting — larger than the entire entry chunk. It is now 914 kB, with the panels in six chunks of their own (files 99, collab 87, packing 71, costs 62, reservations 32, todo 31 kB). The panels also get the error boundaries they never had. fe-error-boundary covered the maps and the plugin frame but not these, so without them a dead panel chunk would throw past to the route boundary and take the whole planner with it. The boundary sits outside the Suspense, since Suspense only owns the pending promise and a rejected one throws straight past it. One boundary per panel rather than one around the content area: a shared one would already be mounted with the visible tab, so switching tabs would swap the entire planner for the placeholder instead of just the part still loading. PluginFrame stays static — DayDetailPanel and PlaceInspector import it from the plan tab anyway, so splitting it here would move nothing. The two import modals stay static for the same reason, via the mobile sheets. The wiring tests now await their panel. That includes the ones still passing: React.lazy caches the resolved module for the whole file, so they were only green because an earlier test had already pulled it in.