Skip to content

Added persistence for original image#288

Open
chetanbarakki wants to merge 1 commit intoc2siorg:mainfrom
chetanbarakki:feature/add-read-image-persistence
Open

Added persistence for original image#288
chetanbarakki wants to merge 1 commit intoc2siorg:mainfrom
chetanbarakki:feature/add-read-image-persistence

Conversation

@chetanbarakki
Copy link
Copy Markdown
Contributor

@chetanbarakki chetanbarakki commented Apr 8, 2026

Description

On app startup, the persisted image should be restored into the pipeline store and the Read Image block label should reflect the restored file name, so the editor returns to the same usable state as before reload. The persistence should be best-effort, with validation, expiry handling, and cleanup for invalid or oversized payloads.

Fixes #287

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

How Has This Been Tested?

Describe the tests you ran to verify your changes.

  • Existing tests pass
  • New tests added
  • Manual testing

Screenshots (if applicable)

Before
https://github.com/user-attachments/assets/24733c14-afe9-41ce-8a55-e5096a130065

After
https://github.com/user-attachments/assets/4cc534e2-a01c-4de7-9ea0-519b0b481610

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review
  • I have added/updated documentation as needed
  • My changes generate no new warnings
  • Tests pass locally

@chetanbarakki
Copy link
Copy Markdown
Contributor Author

@ivantha , Can you please review and let me know if any changes are needed?

@ivantha
Copy link
Copy Markdown
Member

ivantha commented Apr 13, 2026

Reviewed. Adds best-effort image persistence across page reloads: a new imagePersistence.ts hook saves the base64 image with a 7-day TTL and a 3.5 MB size cap, validates and clears stale/malformed entries on load, and restores the image into the pipeline store when the workspace initialises. The ReadImage block extension now reads the persisted filename to restore its label. Note: when rebasing, please reconcile with the changes in #286 which refactors registerImageReset to use a Set-based listener pattern — the two PRs touch overlapping store code. Merging via rebase.

@ivantha
Copy link
Copy Markdown
Member

ivantha commented Apr 13, 2026

Thanks for the PR! It currently has merge conflicts with main (or is behind). Could you rebase onto the latest main and push the updated branch? Happy to merge once it's auto-rebasable.

@chetanbarakki chetanbarakki force-pushed the feature/add-read-image-persistence branch from c29925d to edb2230 Compare April 14, 2026 05:35
@chetanbarakki chetanbarakki force-pushed the feature/add-read-image-persistence branch from edb2230 to 6bb8b38 Compare April 14, 2026 05:38
@chetanbarakki
Copy link
Copy Markdown
Contributor Author

@ivantha , as you suggested updated to match the Set-based listener approach from #286. Instead of storing a single reset callback, the store now keeps a Set of image reset listeners and returns an unregister function from registerImageReset. I also updated readImageExtension to unregister listeners on dispose so the overlap with the store refactor is reconciled cleanly.

I have rebased the code so that it can be merged, please let me know if any changes are required

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.

[Feature] Add persistence for original image during reloads

2 participants