feat(core): Add reusable record and mutation state helpers

Aperta
#58 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@spefalex ci sta già lavorando.

Dal 25/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement layer: library pkg: core

Context

libs/core/src/lib/resource-list.ts:18 provides list state only; apps/demo-material/src/app/pages/resource-edit-page.ts:82,94 manually implement record loads and writes. #48 fixes release correctness; this follow-up consolidates reusable APIs after observing that behavior.

Scope

  • Add injectResourceOne accepting reactive resource/id and an explicit skip state, exposing loading/value/error/reload with latest-request ownership.
  • Add typed create/update/delete helpers with pending/error/result state and a documented concurrency policy. Keep navigation, confirmation and UI notifications caller-owned.
  • Migrate demos/generated code where APIs reduce duplicated lifecycle code; retain existing DataProvider compatibility.

Out of scope

Router integrations inside core, optimistic cache, batch mutations, transport cancellation required of every provider.

Acceptance criteria

  • Tests cover skip, reactive identity, reverse-order promises, destruction, failed mutation/retry and concurrent calls.
  • Public helper types reject invalid arguments without any.
  • Demos/generated consumer behave identically and preserve #48/#42 browser regressions.

Notes for the dev

Touch core primitives/exports/tests and consumers. Depends on release correctness; do not delay 0.1.0 for this API.

Rules: no code comments, no any/$any; standalone components, signals and inject(). Core production imports only @angular/core and local core modules, never router/common/forms/UI. Other Pidrang libraries depend only on core, except @pidrang/cli-supabase which depends on @pidrang/cli as per the package graph in CLAUDE.md; apps compose adapters. Use conventional commits. For UI changes, validate with Playwright against pnpm exec nx serve demo-material and pnpm exec nx serve demo-tailwind; record tested paths and failures. Also validate generated UI in an external consumer fixture when affected.

Depends on

  • #48
  • #57
Lingua principale
TypeScript
Stelle
2
Fork
2
Merge medio
9h 17m
PR unite (30g)
48

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pidrang/pidrang

Tutte le issue di pidrang/pidrang

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.