mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
CL3: align provider nesting and tighten OpsList types
Wrap the estimate-scenario provider outside both flag paths, type empty as nullable, and drop the duplicated fail-closed unit assertion. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
4d035017f2
commit
45eaabd23c
4 changed files with 24 additions and 44 deletions
|
|
@ -126,6 +126,8 @@ export default async function MunicipalitiesPage({ searchParams }: Municipalitie
|
|||
? null
|
||||
: buildMunicipalityListHref({ ...state, priority: 'alta', coverage: 'sem_assessor' }, 1)
|
||||
|
||||
// The overview and the table's filter header stay mounted even with zero
|
||||
// results — only the rows are replaced by the empty state (inside MunicipalityList).
|
||||
const overviewNode =
|
||||
isStaffView && overview ? (
|
||||
<MunicipalityListOverview view={overview} shameHref={shameHref} />
|
||||
|
|
@ -158,31 +160,27 @@ export default async function MunicipalitiesPage({ searchParams }: Municipalitie
|
|||
)
|
||||
|
||||
// Shared pieces; flag only switches the composition shell (CL3 tracer).
|
||||
const main = resolveListUnifiedEnabled() ? (
|
||||
wrapStaffListRegion(
|
||||
isStaffView,
|
||||
// Provider wraps both paths the same way (outside the pending boundary).
|
||||
const main = wrapStaffListRegion(
|
||||
isStaffView,
|
||||
resolveListUnifiedEnabled() ? (
|
||||
<OpsListPage
|
||||
overview={overviewNode}
|
||||
toolbar={filters}
|
||||
table={tableNode}
|
||||
empty={null}
|
||||
footer={footerNode}
|
||||
/>,
|
||||
)
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{wrapStaffListRegion(
|
||||
isStaffView,
|
||||
<>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{overviewNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</>,
|
||||
)}
|
||||
</CampaignListPendingBoundary>
|
||||
/>
|
||||
) : (
|
||||
<CampaignListPendingBoundary>
|
||||
{filters}
|
||||
<CampaignListResults>
|
||||
{overviewNode}
|
||||
{tableNode}
|
||||
{footerNode}
|
||||
</CampaignListResults>
|
||||
</CampaignListPendingBoundary>
|
||||
),
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
import type { ReactNode } from 'react'
|
||||
|
||||
import {
|
||||
OpsListView,
|
||||
type OpsListViewProps,
|
||||
} from '@/components/campaign/shared/OpsListView'
|
||||
import { OpsListView, type OpsListViewProps } from '@/components/campaign/shared/OpsListView'
|
||||
|
||||
export type OpsListPageProps = OpsListViewProps
|
||||
|
||||
/**
|
||||
* CL3 — casca server da factory de listas unificadas.
|
||||
*
|
||||
* Hoje só reencaminha slots para `OpsListView`. Ponto de extensão para OH12
|
||||
* (`OfflineBoundary` → Local vs RSC) sem mudar as pages de domínio.
|
||||
* Reencaminha slots para `OpsListView`. Nome estável para as pages/CL8 pins;
|
||||
* lógica de offline (OH12) vive na rota (`OfflineBoundary`), não aqui.
|
||||
*/
|
||||
export const OpsListPage = ({
|
||||
overview,
|
||||
|
|
@ -20,11 +17,5 @@ export const OpsListPage = ({
|
|||
empty,
|
||||
footer,
|
||||
}: OpsListPageProps): ReactNode => (
|
||||
<OpsListView
|
||||
overview={overview}
|
||||
toolbar={toolbar}
|
||||
table={table}
|
||||
empty={empty}
|
||||
footer={footer}
|
||||
/>
|
||||
<OpsListView overview={overview} toolbar={toolbar} table={table} empty={empty} footer={footer} />
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ export type OpsListViewProps = {
|
|||
toolbar: ReactNode
|
||||
/** A tabela já resolvida (CampaignTable com colunas do domínio). */
|
||||
table: ReactNode
|
||||
/** Empty state (CampaignListEmptyState ou Empty do domínio). */
|
||||
empty: ReactNode
|
||||
/** Empty state (CampaignListEmptyState ou Empty do domínio); null se o empty vive na tabela. */
|
||||
empty: ReactNode | null
|
||||
/** Footer/paginação (CampaignListFooter / CampaignListPagination). */
|
||||
footer: ReactNode
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ import { join } from 'node:path'
|
|||
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag'
|
||||
|
||||
const MUNICIPIOS_PAGE = join(
|
||||
process.cwd(),
|
||||
'src/app/(campaign)/campanha/(app)/municipios/page.tsx',
|
||||
)
|
||||
const MUNICIPIOS_PAGE = join(process.cwd(), 'src/app/(campaign)/campanha/(app)/municipios/page.tsx')
|
||||
|
||||
describe('OpsListPage municipios tracer (CL3)', () => {
|
||||
it('wires LIST_UNIFIED behind OpsListPage on the municipios route', () => {
|
||||
|
|
@ -18,8 +13,4 @@ describe('OpsListPage municipios tracer (CL3)', () => {
|
|||
expect(source).toContain("from '@/components/campaign/shared/OpsListPage'")
|
||||
expect(source).toContain("from '@/lib/opsListRegistry/opsListFlag'")
|
||||
})
|
||||
|
||||
it('keeps the flag fail-closed when LIST_UNIFIED is unset', () => {
|
||||
expect(resolveListUnifiedEnabled({})).toBe(false)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue