Skip to content

fix: prevent item loss during rapid adds in ReflectionMode#10

Merged
jonathan-beebe merged 1 commit into
mainfrom
fix/007-reflection-mode-stale-framework-on-rapid-add
Mar 29, 2026
Merged

fix: prevent item loss during rapid adds in ReflectionMode#10
jonathan-beebe merged 1 commit into
mainfrom
fix/007-reflection-mode-stale-framework-on-rapid-add

Conversation

@jonathan-beebe
Copy link
Copy Markdown
Owner

Summary

  • Use a frameworkRef to always read the latest framework state in handleAdd
  • Sync from prop via useEffect (only when prop changes), preventing stale overwrites from unrelated re-renders (e.g. setText)
  • Optimistically update the ref after each add so consecutive adds build on each other
  • Resolves BUG-007

Test plan

  • New test: adds two items rapidly without re-render between them, verifies both items are preserved in the second onUpdate call
  • Full test suite passes (213 tests)

🤖 Generated with Claude Code

Use a ref to track the latest framework state, synced via useEffect
only when the prop changes. This prevents stale closure reads when
handleAdd fires multiple times before React re-renders with the
updated framework prop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 29, 2026

Deploy Preview for golden-scone-6bfeb1 ready!

Name Link
🔨 Latest commit d9089f5
🔍 Latest deploy log https://app.netlify.com/projects/golden-scone-6bfeb1/deploys/69c94d6c963a4b00089b2115
😎 Deploy Preview https://deploy-preview-10--golden-scone-6bfeb1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jonathan-beebe jonathan-beebe merged commit ae73297 into main Mar 29, 2026
5 checks passed
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