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
|
? null
|
||||||
: buildMunicipalityListHref({ ...state, priority: 'alta', coverage: 'sem_assessor' }, 1)
|
: 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 =
|
const overviewNode =
|
||||||
isStaffView && overview ? (
|
isStaffView && overview ? (
|
||||||
<MunicipalityListOverview view={overview} shameHref={shameHref} />
|
<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).
|
// Shared pieces; flag only switches the composition shell (CL3 tracer).
|
||||||
const main = resolveListUnifiedEnabled() ? (
|
// Provider wraps both paths the same way (outside the pending boundary).
|
||||||
wrapStaffListRegion(
|
const main = wrapStaffListRegion(
|
||||||
isStaffView,
|
isStaffView,
|
||||||
|
resolveListUnifiedEnabled() ? (
|
||||||
<OpsListPage
|
<OpsListPage
|
||||||
overview={overviewNode}
|
overview={overviewNode}
|
||||||
toolbar={filters}
|
toolbar={filters}
|
||||||
table={tableNode}
|
table={tableNode}
|
||||||
empty={null}
|
empty={null}
|
||||||
footer={footerNode}
|
footer={footerNode}
|
||||||
/>,
|
/>
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<CampaignListPendingBoundary>
|
<CampaignListPendingBoundary>
|
||||||
{wrapStaffListRegion(
|
|
||||||
isStaffView,
|
|
||||||
<>
|
|
||||||
{filters}
|
{filters}
|
||||||
<CampaignListResults>
|
<CampaignListResults>
|
||||||
{overviewNode}
|
{overviewNode}
|
||||||
{tableNode}
|
{tableNode}
|
||||||
{footerNode}
|
{footerNode}
|
||||||
</CampaignListResults>
|
</CampaignListResults>
|
||||||
</>,
|
|
||||||
)}
|
|
||||||
</CampaignListPendingBoundary>
|
</CampaignListPendingBoundary>
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
import {
|
import { OpsListView, type OpsListViewProps } from '@/components/campaign/shared/OpsListView'
|
||||||
OpsListView,
|
|
||||||
type OpsListViewProps,
|
|
||||||
} from '@/components/campaign/shared/OpsListView'
|
|
||||||
|
|
||||||
export type OpsListPageProps = OpsListViewProps
|
export type OpsListPageProps = OpsListViewProps
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CL3 — casca server da factory de listas unificadas.
|
* CL3 — casca server da factory de listas unificadas.
|
||||||
*
|
*
|
||||||
* Hoje só reencaminha slots para `OpsListView`. Ponto de extensão para OH12
|
* Reencaminha slots para `OpsListView`. Nome estável para as pages/CL8 pins;
|
||||||
* (`OfflineBoundary` → Local vs RSC) sem mudar as pages de domínio.
|
* lógica de offline (OH12) vive na rota (`OfflineBoundary`), não aqui.
|
||||||
*/
|
*/
|
||||||
export const OpsListPage = ({
|
export const OpsListPage = ({
|
||||||
overview,
|
overview,
|
||||||
|
|
@ -20,11 +17,5 @@ export const OpsListPage = ({
|
||||||
empty,
|
empty,
|
||||||
footer,
|
footer,
|
||||||
}: OpsListPageProps): ReactNode => (
|
}: OpsListPageProps): ReactNode => (
|
||||||
<OpsListView
|
<OpsListView overview={overview} toolbar={toolbar} table={table} empty={empty} footer={footer} />
|
||||||
overview={overview}
|
|
||||||
toolbar={toolbar}
|
|
||||||
table={table}
|
|
||||||
empty={empty}
|
|
||||||
footer={footer}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ export type OpsListViewProps = {
|
||||||
toolbar: ReactNode
|
toolbar: ReactNode
|
||||||
/** A tabela já resolvida (CampaignTable com colunas do domínio). */
|
/** A tabela já resolvida (CampaignTable com colunas do domínio). */
|
||||||
table: ReactNode
|
table: ReactNode
|
||||||
/** Empty state (CampaignListEmptyState ou Empty do domínio). */
|
/** Empty state (CampaignListEmptyState ou Empty do domínio); null se o empty vive na tabela. */
|
||||||
empty: ReactNode
|
empty: ReactNode | null
|
||||||
/** Footer/paginação (CampaignListFooter / CampaignListPagination). */
|
/** Footer/paginação (CampaignListFooter / CampaignListPagination). */
|
||||||
footer: ReactNode
|
footer: ReactNode
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,7 @@ import { join } from 'node:path'
|
||||||
|
|
||||||
import { describe, expect, it } from 'vitest'
|
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)', () => {
|
describe('OpsListPage municipios tracer (CL3)', () => {
|
||||||
it('wires LIST_UNIFIED behind OpsListPage on the municipios route', () => {
|
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 '@/components/campaign/shared/OpsListPage'")
|
||||||
expect(source).toContain("from '@/lib/opsListRegistry/opsListFlag'")
|
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