Files
task-stream/apps/web/src/app/app.config.ts
Josep Piguillem f448207e88 refactor(web): page state with its page, the root keeps the shell's
Only what the header needs from the start stays at the root: the
session, my projects for the command palette, the inbox and push for
the bell, and their adapters. The home page's facades (my work, the
rest of the home, my views, the calendar), Explore's and the proposal
form's are provided by their routes, whose injectors keep them for
when you come back. The other adapters come with the tracker's routes,
now loaded lazily.

The web libs declare "sideEffects": false, so a chunk carries what it
uses and not everything an index.ts exports: main goes from 1.31 MB
to 432 kB of the same initial total, which is still held up by @pi/ui
(one module, with all of Material) and the GraphQL documents, both
needed by the header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 08:34:17 +02:00

48 lines
1.7 KiB
TypeScript

import { provideHttpClient, withFetch } from '@angular/common/http';
import {
ApplicationConfig,
provideBrowserGlobalErrorListeners,
} from '@angular/core';
import {
provideRouter,
withComponentInputBinding,
withRouterConfig,
} from '@angular/router';
import { provideIdentityInfrastructure } from '@task-stream/web/identity/infrastructure';
import {
apiConfigFromLocation,
provideApiConfig,
provideGraphql,
} from '@task-stream/web/shared/infrastructure';
import { providePiUi, ToastService } from '@task-stream/web/shared/ui';
import { Notifications } from '@task-stream/web/tracker/application';
import { provideTrackerShellInfrastructure } from '@task-stream/web/tracker/infrastructure';
import { appRoutes } from './app.routes';
/*
* Composition root of the web client:
* presenters (routes/pages) → application (NgRx signal stores, events) → domain ports ← infrastructure (GraphQL/HTTP)
*/
export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideRouter(
appRoutes,
// Route params / query params straight into component inputs (`key`, `issueKey`, `returnUrl`…).
withComponentInputBinding(),
withRouterConfig({ paramsInheritanceStrategy: 'always' }),
),
provideHttpClient(withFetch()),
providePiUi(),
// API: same origin, proxied in development (proxy.conf.json) and by nginx in Docker.
provideApiConfig(apiConfigFromLocation()),
provideGraphql(),
// Ports → adapters: the shell's here; the pages' with their lazy routes (tracker.routes.ts).
provideIdentityInfrastructure(),
provideTrackerShellInfrastructure(),
{ provide: Notifications, useExisting: ToastService },
],
};