Skip to content

Track selected program by id, not object reference#22

Open
PavelMakarchuk wants to merge 1 commit into
masterfrom
fix-rules-stale-program-ref
Open

Track selected program by id, not object reference#22
PavelMakarchuk wants to merge 1 commit into
masterfrom
fix-rules-stale-program-ref

Conversation

@PavelMakarchuk
Copy link
Copy Markdown
Contributor

Summary

  • When the programs list reloads (e.g. country switch), the previously selected Program object is no longer in the new array, leaving the detail panel showing stale data.
  • Store selectedProgramId in state and derive selectedProgram via useMemo against the current programs list.

Test plan

  • Open /rules (default country=us), select a program, switch country to uk, confirm detail panel clears or reflects the new list rather than showing stale US data.
  • Toggle programs/states view modes — selection still clears as before.
  • Click the same program twice — still toggles closed.

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-model Ready Ready Preview, Comment Apr 30, 2026 2:40pm

Request Review

When the programs list reloads (e.g. country switch), the previously
selected Program object is no longer in the new array, so the detail
panel shows stale data. Hold the id in state and derive the program
from the current list via useMemo.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant