Thinkmill / Thinkmill/keystatic
Feature request: accommodations for event hooks
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 159
- Avg merge
- 21h 41m
- Merged PRs (30d)
- 2
Description
I'm trying to add some automation & verification to my workflow. Some examples:
- When a post is set to 'published', automatically set the 'published_at' field to the current time
- A post may only be published if required fields are filled in
- When a post is created, store a random nonce so I can pass around unpublished drafts with secret URLs
- Disallow saving a post if it's already published and the slug would change
- Alternatively, create a redirect if I change a post slug
I don't know what Keystatic plans for the long term, but I think right now I could do all of this with just a few small changes:
- Commit to the
/updateroute being a stable API so I can build a middleware that intercepts it - Include the collection name and slug as fields in the
POSTbody to/update - Allow the server to signal that the client needs to reload the post content. Maybe a header?
- Have the UI gracefully handle if the server returns an HTTP error status & error message when saving.
With these changes, my server can intercept post updates and change the content however it needs. Looking at the existing network traffic, this feels fairly non-intrusive, but offers big benefits.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the /update route, its POST body, and the UI's save handling using the existing network traffic described in the issue. Determine how collection and slug data, server reload signals, and HTTP error messages would fit together; done means the route contract and client behavior support these event-hook workflows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100