teqo-backup/src/utilities
Francisco Ignácio Fontoura Solla 155f6492d9 B17: column picker on the seven CampaignTable list surfaces.
The picker shipped as a capability of CampaignTable rather than a municípios
feature, so every list that already uses the shared table got it: pass
`columnVisibility` and the table mounts the menu and filters the columns.

Persistence is a cookie, not localStorage, and the reason is a type rather
than a preference: CampaignTableColumn.cell is a function, so the column array
never crosses the server/client boundary and the client cannot rebuild the
table without it. The server filters, so a hidden column does not reach the RSC
payload either. `campaign_columns` carries a listId -> hidden ids map in a
compact form with no JSON and no percent-encoding, because document.cookie and
Next's cookies() disagree about decoding.

Closing the menu is the commit. The first cut debounced at 400 ms, which
batches a burst rather than a reading pace, so unchecking four columns while
reading their labels was four full-route refreshes — on /campanha/liderancas
each one re-pays the ~229 ms / 371-statement render already ledgered P1. The
timer survives at 3 s as a safety net for a menu left open; the price is that
the table behind the menu no longer updates per checkbox.

`defaultVisible` is gone: it was true on 10 columns and false on none, and
storing only the hidden set is what makes a newly shipped column visible to
everyone who never touched the picker. In exchange `label` is required, which
made `head` optional — 24 columns had a head that only restated the new label.
Each surface declares one mandatory column, re-filtered on the server so a
stale cookie cannot leave a row without its only linked cell.

The bug review caught is this codebase's recurring one: the RSC payload of
toggle A arrives inside the window of toggle B, and adopting the server there
undid B and then committed the set without it. Reconciliation now runs only
when no write is pending, pinned red against the previous code.

Municipality column ids are typed against MunicipalityListColumnId now, so the
id, the B22 description and the picker label are one key; the union member
`nivel` was renamed `level` to match the id and the ?level= filter. The
picker's own content comparison is sameIdSet, widened to string ids.
2026-07-28 08:25:16 -03:00
..
access E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
activityDetailPageData.ts C13 pos-simplify: fecha os residuos da varredura e estreita os guards 2026-07-25 21:29:32 -03:00
activityDetailTabUi.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
activityFormData.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
activityLeadershipOptions.ts C13 pos-simplify: fecha os residuos da varredura e estreita os guards 2026-07-25 21:29:32 -03:00
activityPageData.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
activityUi.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
activityViewModels.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
advisorData.ts B34: editable município chips on the leaderships list. 2026-07-27 22:35:19 -03:00
campaignAccess.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
campaignActionContext.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignAuth.ts Add remembered campaign sessions 2026-07-27 08:57:26 -03:00
campaignColumnVisibilityCookie.ts B17: column picker on the seven CampaignTable list surfaces. 2026-07-28 08:25:16 -03:00
campaignConsent.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
campaignDashboardData.ts perf(campanha): roda as funções em gru1 e encurta o waterfall de queries 2026-07-26 21:00:06 -03:00
campaignDemandData.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
campaignEntityActions.ts Break up the god modules into deep domain modules 2026-07-23 23:44:45 -03:00
campaignFormActionError.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignFormFields.ts Add C6 scale/DRY for supporters: bulk import, KPI aggregate, shared shells. 2026-07-18 22:17:31 -03:00
campaignGeolocation.ts B14: municipio mais proximo (atalho geo no Inicio staff) 2026-07-26 17:33:33 -03:00
campaignGoals.ts E9 /simplify: consolidate duplicated helpers, dead passthrough, comment drift 2026-07-25 02:24:18 -03:00
campaignInvite.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
campaignInviteCreation.ts B30: convite WhatsApp na lista de lideranças 2026-07-26 20:47:11 -03:00
campaignInviteOrigin.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignInvitePageData.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignInviteRedemption.ts Import projection-sheet strategy columns into municipalities (E4R fase 2) 2026-07-24 15:58:06 -03:00
campaignInviteRepository.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignJsonMutationRoute.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
campaignListUrl.ts B33: ordenação e filtro no header da lista de dobradinhas 2026-07-26 16:21:40 -03:00
campaignMunicipalityScope.ts perf(campanha): roda as funções em gru1 e encurta o waterfall de queries 2026-07-26 21:00:06 -03:00
campaignPasswordReset.ts Add campaign password reset, profile photo, and RS+ follow-up plan. 2026-07-19 05:26:56 -03:00
campaignPwa.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
campaignPwaClient.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
campaignRelationOptions.ts B36: chips de lideranças na lista de dobradinhas 2026-07-26 21:15:44 -03:00
campaignTime.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
campaignUserProfile.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
consentContentHash.ts Ship /campanha nuclei MVP with RBAC, invites, and vote estimates. 2026-07-18 15:01:56 -03:00
contactPhoneInvariant.ts Ship /campanha nuclei MVP with RBAC, invites, and vote estimates. 2026-07-18 15:01:56 -03:00
dashboardPriorityMunicipalities.ts B20: municípios prioritários no Início com déficit E9 e CTA para a lista. 2026-07-25 20:01:51 -03:00
detailTabUi.ts C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
documentReads.ts Guardas programaticas: fronteira lib/ (no-restricted-imports), ban de consent id hardcoded, codebaseConventions.unit.spec (server-only, copy Praca/Nucleo, listas legadas do eslint, wrappers de formActions), ciclo do payload.config quebrado (documents/globals divididos em tags+reads), timeout global do int suite, personName schema-valido, consent drafts Onda 0 p/ Municipio 2026-07-25 18:02:02 -03:00
documents.ts Guardas programaticas: fronteira lib/ (no-restricted-imports), ban de consent id hardcoded, codebaseConventions.unit.spec (server-only, copy Praca/Nucleo, listas legadas do eslint, wrappers de formActions), ciclo do payload.config quebrado (documents/globals divididos em tags+reads), timeout global do int suite, personName schema-valido, consent drafts Onda 0 p/ Municipio 2026-07-25 18:02:02 -03:00
drizzleBulk.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
electionCache.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
electionCandidateOptions.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
electionResultsImport.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
extractFirstImageFromLexical.ts feat: Add schema-dts to package.json and update SEO metadata 2026-05-01 02:13:39 -03:00
formatRelativeAge.ts Add recent visits panel to /campanha and register VR+ simplify follow-ups. 2026-07-19 04:06:14 -03:00
globalReads.ts Guardas programaticas: fronteira lib/ (no-restricted-imports), ban de consent id hardcoded, codebaseConventions.unit.spec (server-only, copy Praca/Nucleo, listas legadas do eslint, wrappers de formActions), ciclo do payload.config quebrado (documents/globals divididos em tags+reads), timeout global do int suite, personName schema-valido, consent drafts Onda 0 p/ Municipio 2026-07-25 18:02:02 -03:00
globals.ts Guardas programaticas: fronteira lib/ (no-restricted-imports), ban de consent id hardcoded, codebaseConventions.unit.spec (server-only, copy Praca/Nucleo, listas legadas do eslint, wrappers de formActions), ciclo do payload.config quebrado (documents/globals divididos em tags+reads), timeout global do int suite, personName schema-valido, consent drafts Onda 0 p/ Municipio 2026-07-25 18:02:02 -03:00
goalCoverage.ts B20: municípios prioritários no Início com déficit E9 e CTA para a lista. 2026-07-25 20:01:51 -03:00
hookFilledData.ts Add the tooling gate: knip, CI, zero-warning lint, as-never ban 2026-07-23 23:06:12 -03:00
leaderContactsPageData.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
leadershipData.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
leadershipLabels.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
leadershipListFilters.ts Fix Record|Map label lookup typing for the leadership filter summary. 2026-07-28 01:48:18 -03:00
leadershipListUrl.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
leadershipUi.ts Remodel /campanha around predefined Praças replacing electoral nuclei. 2026-07-21 02:28:00 -03:00
loadTerritoryOverview.ts E12: camada TI com rollups MAUP e benchmark intra-TI. 2026-07-26 21:26:47 -03:00
municipalityCandidateComparison.ts Pass 2 W4f: varredura de copy Praca -> Municipio 2026-07-25 15:12:07 -03:00
municipalityDetailTabUi.ts Pass 2 W4c: RSCs das paginas de detalhe extraidos + gemeos de tab dedupados 2026-07-25 15:21:58 -03:00
municipalityDossierData.ts C13 pos-simplify: fecha os residuos da varredura e estreita os guards 2026-07-25 21:29:32 -03:00
municipalityElectionGeography.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
municipalityElectoralBaseline.ts B13: escala relativa no mapa dos Municipios (quantis/LQ/posicao) + artefato TSE v3 2026-07-26 04:22:56 -03:00
municipalityGoalAccount.ts E12: camada TI com rollups MAUP e benchmark intra-TI. 2026-07-26 21:26:47 -03:00
municipalityLabels.ts B17: column picker on the seven CampaignTable list surfaces. 2026-07-28 08:25:16 -03:00
municipalityListFilters.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
municipalityListUrl.ts B17: column picker on the seven CampaignTable list surfaces. 2026-07-28 08:25:16 -03:00
municipalityMapContract.ts B8+: escala das malhas em unidades reais, contrato do map key e degradacao 2026-07-27 01:59:36 -03:00
municipalityMapData.ts B8+: escala das malhas em unidades reais, contrato do map key e degradacao 2026-07-27 01:59:36 -03:00
municipalityMapNavigation.ts B8+: escala das malhas em unidades reais, contrato do map key e degradacao 2026-07-27 01:59:36 -03:00
municipalityPageData.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
municipalityPortfolioIndex.ts B34: editable município chips on the leaderships list. 2026-07-27 22:35:19 -03:00
municipalityPotential.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
municipalityRevalidation.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
municipalitySignal.ts Pass 2 W1-D1: sistema de listas (column defs + CampaignTable) + split do municipalityUi + B16+ 2026-07-25 14:13:04 -03:00
municipalityTerritorialClass.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
municipalityUpdatePageData.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
municipalityViewModels.ts E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
onda0Provision.ts Deliver Onda 0 MVP: provisional Consent, privacy policy, and /privacidade. 2026-07-19 03:38:21 -03:00
organizationData.ts C13 pos-simplify: fecha os residuos da varredura e estreita os guards 2026-07-25 21:29:32 -03:00
payloadTransaction.ts Ship /campanha nuclei MVP with RBAC, invites, and vote estimates. 2026-07-18 15:01:56 -03:00
postgresTransactionLocks.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
posts.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
recentVisits.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
relationship.ts B36: chips de lideranças na lista de dobradinhas 2026-07-26 21:15:44 -03:00
revalidateRequest.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
sameOriginRequest.ts B32+: share the campaign JSON route wrapper, fetch helper and cell auto-save. 2026-07-28 08:07:29 -03:00
seo.ts B33+: close the /simplify rounds on the shared list filter hook 2026-07-27 09:39:15 -03:00
signatureExport.ts Add admin CSV export for signatures and contacts. 2026-07-23 00:53:04 -03:00
stateDeputyData.ts B36: chips de lideranças na lista de dobradinhas 2026-07-26 21:15:44 -03:00
stateDeputyListFilters.ts B33+: close the /simplify rounds on the shared list filter hook 2026-07-27 09:39:15 -03:00
stateDeputyListUrl.ts Deliver B29: header sort and filters on the leaderships list. 2026-07-28 01:43:44 -03:00
supporterErrors.ts Remodel the campaign vertical from Praça to Município 2026-07-23 21:36:20 -03:00
supporterImport.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
supporterImportBulk.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
supporterImportToken.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
supporterListFilters.ts Pass 2 W2: correcoes de fronteira lib/utilities e client boundary 2026-07-25 14:38:41 -03:00
supporterListOverviewAggregate.ts Remodel the campaign vertical from Praça to Município 2026-07-23 21:36:20 -03:00
supporterListSqlFilters.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
supporterPageData.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
supporterUi.ts Pass 2: formatacao da revisao (prettier em tabelas md + ordenacao de imports; SQL da migration inalterado) e remocao de duplicata stray do CampaignListEmptyState no path antigo 2026-07-25 16:53:51 -03:00
supporterViewModels.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
territoryComboboxOptions.ts Pass 2 W4b: zero exports mortos; knip exports/types/enumMembers em ERROR no CI 2026-07-25 15:51:52 -03:00
territoryIntraCaptureBenchmark.ts chore: format after E12 (pre-push gate). 2026-07-26 21:27:23 -03:00
territoryListFilters.ts B33: ordenação e filtro no header da lista de dobradinhas 2026-07-26 16:21:40 -03:00
territoryListLabels.ts E12: camada TI com rollups MAUP e benchmark intra-TI. 2026-07-26 21:26:47 -03:00
territoryListUrl.ts E12: camada TI com rollups MAUP e benchmark intra-TI. 2026-07-26 21:26:47 -03:00
territoryOverview.ts chore: format after E12 (pre-push gate). 2026-07-26 21:27:23 -03:00
visitEligibility.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
visitPlannerData.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
visitPlannerUrl.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
visitPlannerViews.ts E13: visit eligibility checklist and the tour composer. 2026-07-27 21:04:04 -03:00
voteEstimateScenarioFields.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
votePledgeData.ts perf(campanha): roda as funções em gru1 e encurta o waterfall de queries 2026-07-26 21:00:06 -03:00
votePledgeViews.ts Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00