fix(plugins): show a trip page that replaces a core tab while that tab's addon is off

A trip-page plugin that replaces Lists, Costs, Documents or Collab is a stand-in
for the core tab, so its own tab stays on the trip whatever that addon is set to.
This commit is contained in:
Maurice
2026-11-23 14:53:34 +01:00
parent 9d4e52ddfc
commit fd10ce2876
4 changed files with 6 additions and 43 deletions
@@ -149,7 +149,7 @@ describe('useTripPlanner — the trip’s own addons', () => {
expect(tabIds(result)).toContain('tour-planner');
});
it('FE-TP-TRIPADDONS-004: a plugin page that replaces Costs follows the Costs addon of the trip', async () => {
it('FE-TP-TRIPADDONS-004: a plugin page that replaces Costs stays while the trip has Costs off', async () => {
seedInstanceAddons(['budget']);
usePluginStore.setState({
plugins: [
@@ -162,7 +162,8 @@ describe('useTripPlanner — the trip’s own addons', () => {
const { result } = await renderPlanner();
await waitFor(() => expect(tabIds(result)).not.toContain('plugin:ledger'));
await waitFor(() => expect(useTripAddonsStore.getState().trips['1:42']?.status).toBe('ready'));
expect(tabIds(result)).toContain('plugin:ledger');
expect(tabIds(result)).toContain('plugin:notes');
expect(tabIds(result)).not.toContain('finanzplan');
});
@@ -71,7 +71,6 @@ import { TRIP_SPLASH_AFTER_MS } from '../../components/shared/useTripSplashBeats
import { useFlightLiveSync } from '../../components/Planner/flightLive/useFlightLiveSync'
import { useMailPrefillLink } from '../../components/MailIngest/useMailPrefillLink'
import { usePlannerAddons } from './usePlannerAddons'
import { pluginPageShown } from '../../utils/tripAddons'
/**
* The trip's roster from the server: the owner and the members. Null offline
@@ -214,8 +213,7 @@ export function useTripPlanner() {
}, [])
// A plugin page that replaces a core tab follows that tab's addon on this trip.
const tripPagePlugins = allPlugins.filter(p => p.type === 'trip-page' && pluginPageShown(p.tripPage?.replaces, id => !!enabledAddons[id]))
const tripPagePlugins = allPlugins.filter(p => p.type === 'trip-page')
const tripPluginIds = tripPagePlugins.map(p => p.id).join(',')
// A trip-page plugin may replace core tabs while it's active (its manifest names