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

Open
#58 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@spefalex is already working on this.

Since Sep 25, 2026.

Assessment

This issue has not been assessed yet.

Description

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
Dominant language
TypeScript
Stars
2
Forks
2
Avg merge
9h 17m
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pidrang/pidrang

All issues in pidrang/pidrang

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.