Repository navigation
Read a snapshot's content only when it is asked for - #40
Merged
Merged
Conversation
A stored snapshot can be 15 MB, and Payload read all of it for every list, every relationship it filled in and every admin page. A snapshot's edit page carried the whole thing in a JSON editor under the panel. A read, create, update or delete that names no select now answers with every field except the content. A select that names it gets it, and a caller's own select is left as asked. The content field is on the new-snapshot form only. The lock on sealed content doesn't depend on this: an update is still compared with the stored document, read whole. Also fixes the admin panels showing the old status after Payload's own Save. They read from the site again when Payload reports the document saved. The plugin has no release, so nothing in use changes. Tested: 631 unit tests (247 in the plugin, 10 new), 58 smoke checks on the built example site, and five deliberate breaks, each caught. Run in headless Chrome from a scratch script, outside CI. Not explained: in that run Payload's read-only Counts group once showed no fields under its heading after a snapshot was made through the form; four shorter runs drew them. Not tested: Postgres, SQLite, a browser with a window. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A stored snapshot can be 15 MB. Payload read all of it for every list, every relationship it filled in and every admin page, and a snapshot's edit page carried the whole thing in a JSON editor under the panel.
What changes
selectanswers with every field exceptsnapshot.select: { snapshot: true }, REST?select[snapshot]=trueor GraphQL'sselect: truegives the content. A caller's ownselectis left exactly as asked. The export endpoint and the read API are as before.The plugin has no release yet, so nothing in use changes. Hosts' code that read
doc.snapshotfrom a plain read, or from an after-read or after-change hook's document, has to select it. ADR 0012, point 17.Tested
docs/test-audit.md).PATCHwith the status and no content.Not explained, and not tested
No new service and no cost.
🤖 Generated with Claude Code