---
phase: 72-per-page-persistence
plan: 01
subsystem: ui
tags: [localStorage, pagination, table-list, UX]

requires: []
provides:
  - Per page persistence via localStorage for all table-list instances
affects: []

tech-stack:
  added: []
  patterns: [per-page localStorage key in table-list component]

key-files:
  created: []
  modified: [resources/views/components/table-list.php]

key-decisions:
  - "Dedykowany klucz per_page zamiast polegania na query restore"
  - "URL per_page ma priorytet nad localStorage — sync a nie override"

patterns-established:
  - "perPageKey = storagePrefix + '_per_page' — nowy klucz w rodzinie tableList_ storage"

duration: 5min
started: 2026-04-07T12:20:00Z
completed: 2026-04-07T12:25:00Z
---

# Phase 72 Plan 01: Per Page Persistence Summary

**Zapamiętywanie wybranej liczby wierszy w localStorage — per_page persist dla wszystkich list table-list.**

## Performance

| Metric | Value |
|--------|-------|
| Duration | ~5min |
| Tasks | 1 completed |
| Files modified | 1 |

## Acceptance Criteria Results

| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: Zapis per_page do localStorage | Pass | writeJson przy change + sync z URL |
| AC-2: Odczyt per_page z localStorage | Pass | Auto-submit gdy brak per_page w URL |
| AC-3: URL ma priorytet nad localStorage | Pass | urlParams.has('per_page') → sync only |
| AC-4: Brak pętli przeładowań | Pass | Po submit URL zawiera per_page → brak ponownego submit |

## Accomplishments

- Dodano `perPageKey` do rodziny kluczy localStorage w table-list.php
- Zapis przy zmianie selecta per_page (przed submit)
- Odczyt i auto-redirect przy wejściu bez per_page w URL
- Sync localStorage z URL gdy per_page jawnie podane

## Files Created/Modified

| File | Change | Purpose |
|------|--------|---------|
| `resources/views/components/table-list.php` | Modified | perPageKey + save/restore logic |

## Decisions Made

| Decision | Rationale | Impact |
|----------|-----------|--------|
| Dedykowany klucz per_page | Query restore przywraca caly URL (status, page, search) — per_page powinien byc niezalezny | Mozna zmienic per_page bez resetowania filtrow |
| URL ma priorytet | Jawny link z per_page=20 powinien dzialac przewidywalnie | Brak niespodzianek przy linkach bookmarkowanych |

## Deviations from Plan

None — plan executed exactly as written

## Issues Encountered

None

## Next Phase Readiness

**Ready:**
- Wszystkie listy table-list automatycznie korzystaja z persistence per_page

**Concerns:**
- None

**Blockers:**
- None

---
*Phase: 72-per-page-persistence, Plan: 01*
*Completed: 2026-04-07*
