[{"data":1,"prerenderedAt":278},["ShallowReactive",2],{"blog-frontend-architecture-10-en":3},{"number":4,"title":5,"summary":6,"parts":7,"toc":14,"minutes":277},10,"The facade, and when to skip it","A facade is a thin object between features and state management. It exposes state (signals in Angular, values in React, refs in Vue) and intentions…",[8,11],{"kind":9,"name":10},"diagram","fe-flow",{"kind":12,"html":13},"html","\u003Cp>A facade is a thin object between features and state management. It exposes \u003Cstrong>state\u003C\u002Fstrong> (signals in Angular, values in React, refs in Vue) and \u003Cstrong>intentions\u003C\u002Fstrong> (methods). It contains no logic: each method dispatches exactly one event, and each property is exactly one selector.\u003C\u002Fp>\n\u003Cp>\u003Ccode>libs\u002Fmaintenance\u002Fdata-access\u002Fsrc\u002Flib\u002Fwork-orders.facade.ts\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cpre class=\"shiki shiki-themes github-light github-dark\" style=\"--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { inject, Service } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '@angular\u002Fcore'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { Store } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '@ngrx\u002Fstore'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> type\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { WorkOrder, WorkOrderFilter } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '@fleetline\u002Fmaintenance\u002Fmodel'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { workOrdersPage } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '.\u002Fwork-orders.events'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { workOrdersFeature } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '.\u002Fwork-orders.feature'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">@\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">Service\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">({ autoProvided: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">false\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> })\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">export\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> WorkOrdersFacade\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  private\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> store\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> inject\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(Store);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> visible\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">selectSignal\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersFeature.selectVisible);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> overdueCount\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">selectSignal\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersFeature.selectOverdueCount);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> filter\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">selectSignal\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersFeature.selectFilter);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> loading\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">selectSignal\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersFeature.selectLoading);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  readonly\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\"> error\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">selectSignal\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersFeature.selectError);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">  open\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">depotId\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> string\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">)\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> void\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">    this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">dispatch\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersPage.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">opened\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">({ depotId }));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">  }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">  filterBy\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">filter\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> Partial\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">&#x3C;\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">Omit\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">&#x3C;\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">WorkOrderFilter\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'depotId'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">>>)\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> void\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">    this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">dispatch\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(workOrdersPage.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">filterChanged\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">({ filter }));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">  }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">  assign\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">order\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> WorkOrder\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">assigneeId\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> string\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">)\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> void\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">    this\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.store.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">dispatch\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">      workOrdersPage.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">assigneeChosen\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">({ id: order.id, assigneeId, previousAssigneeId: order.assigneeId }),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    );\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">  }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>autoProvided: false\u003C\u002Fcode> turns off providing in \u003Ccode>root\u003C\u002Fcode>. The facade is provided by \u003Ccode>provideWorkOrders()\u003C\u002Fcode>, so it exists exactly where its store feature exists.\u003C\u002Fp>\n\u003Ch3 id=\"s10-1\">10.1. Why a facade\u003C\u002Fh3>\n\u003Cul>\n\u003Cli>\u003Cstrong>Replaceable state.\u003C\u002Fstrong> The day work orders move from the NgRx Store to a Signal Store or to a server cache, the facade changes and no component does. Fleetline did exactly this for \u003Ccode>fleet\u003C\u002Fcode> (section 7.1).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A small surface.\u003C\u002Fstrong> A feature sees six members instead of fourteen actions and nine selectors.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Easy tests.\u003C\u002Fstrong> A feature test provides a fake object with the same shape (section 15).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The same shape in every framework.\u003C\u002Fstrong> The class here, \u003Ccode>useWorkOrders()\u003C\u002Fcode> in React and Vue: the feature code reads almost the same in all three (section 14).\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3 id=\"s10-2\">10.2. Why the facade is optional\u003C\u002Fh3>\n\u003Cp>The NgRx community has a good argument against facades: actions should describe events (\u003Cem>&quot;assignee chosen on the work orders page&quot;\u003C\u002Fem>), and a facade with a method \u003Ccode>assign()\u003C\u002Fcode> invites thinking in commands. A facade that dispatches three actions in a row, or that holds logic, hides the event log that makes NgRx debuggable.\u003C\u002Fp>\n\u003Cp>So in our variant the facade is a rule with conditions:\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Use a facade when\u003C\u002Fth>\n\u003Cth>Skip it when\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>more than one feature uses the same state\u003C\u002Ftd>\n\u003Ctd>one feature owns one small store feature\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>the state may change implementation (Store ↔ Signal Store ↔ server cache)\u003C\u002Ftd>\n\u003Ctd>the state is local to a component: use a Signal Store or plain signals in the component\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>the data is offered to another domain through \u003Ccode>api\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>the team prefers dispatching events directly and the domain is small\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>the code base is shared with React or Vue teams\u003C\u002Ftd>\n\u003Ctd>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Two rules when you do use one:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>Method names keep the event.\u003C\u002Fstrong> \u003Ccode>assign()\u003C\u002Fcode> dispatches \u003Ccode>assigneeChosen\u003C\u002Fcode> from the \u003Ccode>Work Orders Page\u003C\u002Fcode> source. If two pages can assign, each page gets its own event; the facade gets two methods or a \u003Ccode>source\u003C\u002Fcode> parameter, never one generic \u003Ccode>update()\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>No logic.\u003C\u002Fstrong> No \u003Ccode>if\u003C\u002Fcode>, no loop, no call to HTTP. If it needs a decision, the decision belongs in a reducer, a selector or an effect.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>Without a facade, the \u003Ccode>index.ts\u003C\u002Fcode> of \u003Ccode>data-access\u003C\u002Fcode> exports the page events and the selectors instead, and the component calls \u003Ccode>store.dispatch()\u003C\u002Fcode> and \u003Ccode>store.selectSignal()\u003C\u002Fcode> itself. Both shapes pass the boundary rules; pick one per domain and write it in the domain's README.\u003C\u002Fp>\n",[15,29,33,37,41,61,77,93,117,145,157,177,217,245,249,253,273],{"id":16,"text":17,"depth":18,"children":19},"s1","1. Why front-ends need an architecture",2,[20,25],{"id":21,"text":22,"depth":23,"children":24},"s1-1","1.1. Goals",3,[],{"id":26,"text":27,"depth":23,"children":28},"s1-2","1.2. Non-goals",[],{"id":30,"text":31,"depth":18,"children":32},"s2","2. Where the idea comes from",[],{"id":34,"text":35,"depth":18,"children":36},"s3","3. The architecture on one page",[],{"id":38,"text":39,"depth":18,"children":40},"s4","4. Vocabulary",[],{"id":42,"text":43,"depth":18,"children":44},"s5","5. The example: Fleetline",[45,49,53,57],{"id":46,"text":47,"depth":23,"children":48},"s5-1","5.1. Applications",[],{"id":50,"text":51,"depth":23,"children":52},"s5-2","5.2. Domains and teams",[],{"id":54,"text":55,"depth":23,"children":56},"s5-3","5.3. The workspace",[],{"id":58,"text":59,"depth":23,"children":60},"s5-4","5.4. One use case through the layers",[],{"id":62,"text":63,"depth":18,"children":64},"s6","6. Library types",[65,69,73],{"id":66,"text":67,"depth":23,"children":68},"s6-1","6.1. Who may import whom",[],{"id":70,"text":71,"depth":23,"children":72},"s6-2","6.2. How big is a library",[],{"id":74,"text":75,"depth":23,"children":76},"s6-3","6.3. Styles",[],{"id":78,"text":79,"depth":18,"children":80},"s7","7. Domains and boundaries",[81,85,89],{"id":82,"text":83,"depth":23,"children":84},"s7-1","7.1. The API library",[],{"id":86,"text":87,"depth":23,"children":88},"s7-2","7.2. Shared is a domain too",[],{"id":90,"text":91,"depth":23,"children":92},"s7-3","7.3. When two domains need the same thing",[],{"id":94,"text":95,"depth":18,"children":96},"s8","8. Enforcing the rules",[97,101,105,109,113],{"id":98,"text":99,"depth":23,"children":100},"s8-1","8.1. Tags",[],{"id":102,"text":103,"depth":23,"children":104},"s8-2","8.2. The lint rule",[],{"id":106,"text":107,"depth":23,"children":108},"s8-3","8.3. The framework dimension",[],{"id":110,"text":111,"depth":23,"children":112},"s8-4","8.4. Without Nx: Sheriff",[],{"id":114,"text":115,"depth":23,"children":116},"s8-5","8.5. In CI",[],{"id":118,"text":119,"depth":18,"children":120},"s9","9. State with NgRx",[121,125,129,133,137,141],{"id":122,"text":123,"depth":23,"children":124},"s9-1","9.1. The model",[],{"id":126,"text":127,"depth":23,"children":128},"s9-2","9.2. Events",[],{"id":130,"text":131,"depth":23,"children":132},"s9-3","9.3. The feature: state, reducer, selectors",[],{"id":134,"text":135,"depth":23,"children":136},"s9-4","9.4. HTTP and effects",[],{"id":138,"text":139,"depth":23,"children":140},"s9-5","9.5. Providers",[],{"id":142,"text":143,"depth":23,"children":144},"s9-6","9.6. The public API of data-access",[],{"id":146,"text":147,"depth":18,"children":148},"s10","10. The facade, and when to skip it",[149,153],{"id":150,"text":151,"depth":23,"children":152},"s10-1","10.1. Why a facade",[],{"id":154,"text":155,"depth":23,"children":156},"s10-2","10.2. Why the facade is optional",[],{"id":158,"text":159,"depth":18,"children":160},"s11","11. Angular end to end",[161,165,169,173],{"id":162,"text":163,"depth":23,"children":164},"s11-1","11.1. The ui library",[],{"id":166,"text":167,"depth":23,"children":168},"s11-2","11.2. The feature library",[],{"id":170,"text":171,"depth":23,"children":172},"s11-3","11.3. The shell",[],{"id":174,"text":175,"depth":23,"children":176},"s11-4","11.4. The application",[],{"id":178,"text":179,"depth":18,"children":180},"s12","12. React and Next.js",[181,185,189,193,197,201,205,209,213],{"id":182,"text":183,"depth":23,"children":184},"s12-1","12.1. What maps to what",[],{"id":186,"text":187,"depth":23,"children":188},"s12-2","12.2. Tags for server and client",[],{"id":190,"text":191,"depth":23,"children":192},"s12-3","12.3. HTTP and the query client",[],{"id":194,"text":195,"depth":23,"children":196},"s12-4","12.4. Queries and mutations",[],{"id":198,"text":199,"depth":23,"children":200},"s12-5","12.5. Client state in Zustand",[],{"id":202,"text":203,"depth":23,"children":204},"s12-6","12.6. The facade hook",[],{"id":206,"text":207,"depth":23,"children":208},"s12-7","12.7. Feature, ui and route",[],{"id":210,"text":211,"depth":23,"children":212},"s12-8","12.8. The shell and another domain's API",[],{"id":214,"text":215,"depth":23,"children":216},"s12-9","12.9. Pitfalls specific to Next.js",[],{"id":218,"text":219,"depth":18,"children":220},"s13","13. Vue and Nuxt",[221,225,229,233,237,241],{"id":222,"text":223,"depth":23,"children":224},"s13-1","13.1. What maps to what",[],{"id":226,"text":227,"depth":23,"children":228},"s13-2","13.2. Turn off auto-imports for libraries",[],{"id":230,"text":231,"depth":23,"children":232},"s13-3","13.3. The store",[],{"id":234,"text":235,"depth":23,"children":236},"s13-4","13.4. The facade composable and store scope",[],{"id":238,"text":239,"depth":23,"children":240},"s13-5","13.5. Feature, ui, shell and page",[],{"id":242,"text":243,"depth":23,"children":244},"s13-6","13.6. Pitfalls specific to Nuxt",[],{"id":246,"text":247,"depth":18,"children":248},"s14","14. Side by side",[],{"id":250,"text":251,"depth":18,"children":252},"s15","15. Testing per library type",[],{"id":254,"text":255,"depth":18,"children":256},"s16","16. Growing into it and migrating",[257,261,265,269],{"id":258,"text":259,"depth":23,"children":260},"s16-1","16.1. Migration in eight steps",[],{"id":262,"text":263,"depth":23,"children":264},"s16-2","16.2. What usually goes wrong",[],{"id":266,"text":267,"depth":23,"children":268},"s16-3","16.3. When to split a library",[],{"id":270,"text":271,"depth":23,"children":272},"s16-4","16.4. When this is too much",[],{"id":274,"text":275,"depth":18,"children":276},"s17","17. Questions",[],36,1795449737260]