Blog

EmDash 1.6: more from the cache, more room in the editor

Images and missing pages are served from the cache, the editor can hide its settings panel, nested admin pages show breadcrumbs, and plugin panels can work on the draft you have open.

EmDash 1.6 gets more out of your route cache. Images are cached for a year and cleared when you replace them, and pages for missing entries can be cached briefly.

The editor can hide its settings panel, nested admin pages show breadcrumbs, and plugin panels can work on the draft you have open. Italian, Lithuanian and Vietnamese join the admin languages, and scheduled entries go live on the minute. All on top of the usual fixes.

Highlights include:

To update, run this from the project directory:

npx upgrade-emdash@latest

Or update by hand:

pnpm up --latest emdash
# or if you are using Cloudflare
pnpm up --latest emdash @emdash-cms/cloudflare

Database migrations: this release adds one, 098_user_last_login. It adds a last_login_at column to the users table so the Users page can show when someone last signed in (#4805). It runs automatically with the default auto migration mode and needs no action.

One item needs action after you deploy: to make Used in count file links in existing entries, run the media usage repair once.

Images are cached for a year

On sites with a route-cache provider such as cacheCloudflare(), EmDash now caches image files for a year, both original files and resized versions (#4911, thanks @swissky). Repeat requests no longer read the file from storage or resize it again. Replacing an image, or deleting one, clears the original and all its resized versions from the cache. That covers the Media Library, the media picker, MCP media_delete and ctx.media.delete() in plugin routes.

There's nothing to turn on. A few limits apply:

  • Audio, video and partial responses aren't cached.
  • Resized versions are cached only with Astro's default image service on Node.js or @astrojs/cloudflare/image-service-workerd on Cloudflare. With those services, /_image URLs for EmDash media whose query string has unknown or repeated parameters, or parameters in a different order, now redirect to the standard form. URLs built by <Image> and getImage() are already in that form.
  • Astro's memoryCache() doesn't cache media. Page caching with it works as before.

Changing files directly in the storage bucket doesn't clear the cache. See Media files for the full list.

Missing pages can be cached

Pages for entries that don't exist, such as an unknown slug rewritten to /404, were rendered on every request. With a route cache configured, those 404s can now be cached for up to 60 seconds (#4992). Publishing the missing entry clears the cached 404, as long as the cache knows which collection it belongs to.

To make that work, getEmDashEntry() now returns its collection tag in cacheHint when it finds no entry (#4994, thanks @swissky). Pass the hint to the cache before you rewrite, as the templates now do:

---
const { entry, cacheHint } = await getEmDashEntry("posts", slug);
Astro.cache.set(cacheHint);
if (!entry) return Astro.rewrite("/404");
---

Without the collection tag, a newly published entry can show a cached 404 for up to a minute. To keep 404s out of the cache, call Astro.cache.set(false) in the 404 page. Cached 404s don't reach the site, so the admin's 404 log doesn't count them. See Error responses.

Hide the settings panel

On screens 1024px and wider, the content editor has a Hide settings button at the end of its bar (#4779, thanks @khoinguyenpham04). Hiding the panel centers the page in the full width, and Show settings brings it back. Each browser remembers your choice. The panel still opens when you edit image or gallery settings, or when a field inside it stops a save.

The editor with the settings panel hidden: the Title, Featured Image and Content fields centered in the full width, and Live View, Preview, Unpublish Post and the panel toggle in the bar

The button replaces distraction-free mode, which has been removed along with its ⌘⇧\ (Ctrl+Shift+\) shortcut. On smaller screens, the same button takes the place of Settings and opens the panel over the page. Publish and Unpublish also have matching globe icons now.

Pages that sit under another page now show a trail in the admin header, such as Settings › General, Menus › Main navigation or Media › Product photos (#4939, thanks @khoinguyenpham04). The first crumb takes you back, and it replaces the back buttons those pages had.

The Media Library inside the Product photos folder, with "Media › Product photos" in the admin header

When you leave a media folder, by any route including the browser's Back button, the library keeps its scroll position. On phones, View Site and the Staging badge show only their icons.

Enter confirms safe actions

Confirmation dialogs now open with a button focused, so Enter does something useful (#4854, thanks @khoinguyenpham04). For something you can undo, such as Publish now, Move to Trash or Restore this version, Enter confirms. For something permanent, such as Delete Permanently, Enter cancels. Publishing over a schedule and restoring a version over unsaved edits count as permanent.

Unpublish in the editor, and bulk Publish and Set to draft in the content list, now ask for confirmation too. The Publish and plugin Uninstall dialogs no longer close when you click outside them.

Plugin panels can edit the open draft

Trusted plugins can now read and change the draft that's open in the editor, including unsaved edits (#4626, thanks @khoinguyenpham04). A content editor panel receives editorDraft next to entry:

  • editorDraft.get() returns the field values, slug, SEO title and meta description, with their definitions and a revision.
  • editorDraft.patch(operations, { expectedRevision }) sets or clears those values in the form without saving.

If any value changed after the panel read it, the patch is refused, so a translation or excerpt panel can't overwrite edits you made while it worked. Patched values appear in the form for you to review and save like your own. In collections with revisions, the first save after a patch keeps the draft it replaced, so you can restore it. editorDraft is undefined on older EmDash versions. The React admin guide covers the rules and has a translation example.

Patches from sandboxed panels and actions also work better. A patched rich text field now shows the patched text, where before the next keystroke wrote the old text back. A patch with rich text the editor can't load is refused without changing the form. The "Plugin changes were not applied" message is now a toast instead of a banner that stayed on screen.

The Used in list on a media item now includes places that link to the file by its /_emdash/api/media/file/ URL (#4968). That covers links in rich text, href and src in HTML blocks, and string or URL fields that hold the URL, including inside blocks and repeaters. Both root-relative URLs and full URLs copied from the Media Library count. External URLs and URLs inside plain text don't.

Existing entries aren't re-indexed on their own. After upgrading, run this once against the site, or save the affected entries again:

npx emdash media repair-usage --all --url https://example.com

The media_usage_repair MCP tool, with { "scope": "all" }, does the same. Until then, a linked file can still show No tracked references found. See Fixed: media URL link usage.

Scheduled entries go live on time

Scheduled entries used to go live up to a minute late, depending on when the next scheduler run happened to start. Now an entry scheduled for a whole minute, as the admin sets it, goes live at that minute (#4787, thanks @khoinguyenpham04).

On Cloudflare, each Cron Trigger run now waits up to 70 seconds for upcoming entries and publishes each one at its time. Waiting uses no CPU time, but a waiting run stays open for up to about a minute, so consecutive runs can overlap in Workers logs and metrics. On Node.js, the scheduler now runs at the start of every minute. A schedule with seconds, which only the API and MCP can set, can still be up to a minute late on Node.js.

Sites that use createScheduledHandler() from @emdash-cms/cloudflare/worker, as the starter templates do, get this automatically. A custom Worker entry point that calls runScheduledTasks() itself still publishes only entries that are already due. To wait for upcoming entries, pass the new option:

await runScheduledTasks({ publishUpcomingWithinMs: 70 * 1000 });

A scheduled publish that another run or an editor has already completed no longer runs content:beforePublish hooks, so a hook can't reject an entry that is already live. See Scheduled publishing to check your Cron Trigger.

The admin in more languages

Upgrade notes

Most sites need only the usual update and the media usage repair above. Check this list for anything else that applies to yours:

  • Kumo 2.19. The admin, @emdash-cms/blocks, and the Forms, Field Kit, AI Moderation and AI Search plugins now require exactly @cloudflare/kumo@2.19.0. Update emdash and these plugins together, and update Kumo if you install it yourself. Plugin admin pages may need changes to Radio.Group tests, DatePicker style overrides and Dialog maximum heights (#4940, thanks @khoinguyenpham04). See Upgrade to Kumo 2.19.
  • Durable Object SQL. Update emdash and @emdash-cms/cloudflare together (#4866).
  • Search scores. search() now returns scores from 0 to 1 within each collection, and ranks title matches first (#4194). Keep the order it returns, and review any custom score thresholds. searchCollection() is unchanged.
  • Search index repair. Search no longer counts every row of an existing index on a cold start. Missing and empty indexes are still repaired automatically, but a partly filled one isn't detected. To rebuild one, send POST /_emdash/api/search/rebuild as an Admin (#4760). See search index recovery.
  • Translated navigation. On pages in a non-default locale, layouts that call getMenu() and getTaxonomyTerms() without a locale still get default-locale data, now with an extra read. To render translated navigation and reuse the prefetched data, pass { locale: Astro.currentLocale } (#4857).
  • Comment dates. <Comments> now shows dates in the site's Timezone setting, or UTC if none is set, instead of the server's timezone (#4910). Set Timezone in Settings to choose.
  • Type checks. The Astro.locals.emdash handler types now match what they return. Code that deletes a required property, such as delete item.draftRevisionId, no longer type-checks. Destructure instead: const { draftRevisionId, ...rest } = item (#4935).
  • Shared entry reads. Identical getEmDashEntry() calls in one request now return the same object, as getEmDashCollection() already did. Copy entry data before you change it (#4926).
  • SQLite reset scripts. EmDash no longer opens a SQLite database whose main file is missing while its -wal or -shm file remains, since that could lose committed content (#4812). Scripts that reset a local database by deleting data.db must also delete data.db-wal and data.db-shm.
  • External sign-in role levels. EmDash now refuses a sign-in from a provider such as Cloudflare Access that maps to a role level other than 10, 20, 30, 40 or 50, instead of saving it and locking the user out (#4935). A user already saved with such a level still can't sign in. Fix the role mapping, then set that user's role in the users table to a defined level.
  • Distraction-free mode is gone. Use Hide settings instead (#4779).

Smaller improvements and fixes

Editing and the admin

  • Dashboard counts, content lists, the calendar, trash and content search refresh after you save, publish, unpublish, delete or restore content (#4832).
  • A slug edit made while a manual save is in progress is no longer lost (#4626, thanks @khoinguyenpham04).
  • Visual editing links to fields inside blocks open the right block, repeater item and Advanced section, and links to the publication date, bylines, slug and SEO open the settings panel (#4905). Clicking into an unchanged rich text field and leaving no longer creates a draft (#4871).
  • Custom flat taxonomies, such as Topics, show the tag icon in the sidebar instead of the Categories icon (#4980). The switches on Settings → Sidebars are easier to read in dark mode (#4893). Thanks @khoinguyenpham04.
  • The loading spinner is centered (#5033, thanks @SantiagoSM2000). Date pickers use Kumo's refreshed day and month buttons (#4940).
  • The Users page shows the last sign-in for magic-link, OAuth, AT Protocol and external-provider sign-ins, not just passkeys. Earlier sign-ins appear after the next one (#4805).
  • Self-signup on an allowed domain no longer fails with "Setup already complete" when creating a passkey (#4864).

Media

  • Media Library, media picker and folder searches no longer fail on D1 for long terms. Media search also matches storage keys, media IDs and pasted file URLs (#4947).
  • Image sub-fields in repeaters respect their allowedMimeTypes, so a repeater can accept SVG without changing the site-wide allowlist (#4929).
  • Replacing a file now runs media:afterUpload, so plugins, the audit log and webhooks see replacements (#4868).
  • The Node.js image endpoint serves the original image instead of a 500 when Astro can't optimize it (#4935).
  • Concurrent saves on Workers no longer hang while updating media usage, and recover from a cancelled request within a minute (#4960).

Public pages and performance

  • Fewer database reads on D1: search skips full index counts on cold starts (#4760) and checks indexes across collections in a few round trips (#5010). A fresh isolate no longer writes to the database to release stale plugin cron locks (#4999, thanks @swissky).
  • Pages that call Astro.rewrite(), such as to /404, reuse the original request's reads (#4840). Repeated identical getEmDashEntry() calls share one read (#4926). Multilingual layouts prefetch menus and terms in the page's locale (#4857).
  • Pages using the object cache on Workers no longer fail to render after a request is cancelled, including with adapters such as Alchemy (#4970).
  • Sitemap lastmod dates update when you change SEO metadata (#4976).
  • Exact redirects for paths with file extensions, such as /old/report.pdf, now apply (#4964).
  • Published code blocks can be focused and scrolled with the keyboard (#4967).
  • Static sites no longer log Astro warnings about request headers on prerendered pages or cache.set() on 404s (#4837).

PostgreSQL

  • Built-in search on PostgreSQL, including Hyperdrive, returns 503 SEARCH_UNAVAILABLE instead of errors or empty results, and the link picker suggests pasting a URL (#4890). Built-in search still needs SQLite or D1.
  • Plugin storage no longer fails with json_extract errors during astro dev with Hyperdrive (#4972).

Plugins

  • Plugin routes no longer return 404 Plugin route not found on warm Cloudflare isolates after a plugin is installed, updated or uninstalled (#4866).
  • On Node.js, sandboxed plugins stop when the host process exits, including in Docker (#4799), and a plugin that runs past its time limit is stopped instead of running on (#4800).
  • Media pickers work in plugin rich text repeaters, and show the selected image in a compact card with Replace and Remove (#4440, thanks @khoinguyenpham04).
  • The Webhooks dashboard widget loads and shows its Delivered and Failed counts (#4795, thanks @b1ngx).
  • The plugin registry's moderation packages can describe findings in a release's code, with an optional severity (#4914).

API, CLI and types

  • Rich text read and written back through the CLI, MCP or EmDashClient no longer turns literal # Title or 1. item text into headings and lists (#4238, thanks @danielmlr).
  • EmDashClient errors keep the text of non-JSON error responses (#4965).
  • createKyselyAdapter() accepts EmDash's own database without a cast, and fetchVerifiedResource() bytes can go straight into new Response() (#4935).

The same release commit updates @emdash-cms/admin, @emdash-cms/auth, @emdash-cms/auth-atproto, @emdash-cms/blocks, @emdash-cms/cloudflare, @emdash-cms/registry-moderation, @emdash-cms/registry-verification, @emdash-cms/sandbox-workerd, and the AI Moderation, AI Search, Field Kit, Forms and Webhook Notifier plugins with the changes above. @emdash-cms/plugin-cli, @emdash-cms/plugin-test, @emdash-cms/registry-client, @emdash-cms/registry-loader and the Embeds plugin have dependency-only updates, and create-emdash, @emdash-cms/gutenberg-to-portable-text and @emdash-cms/x402 received matching 1.6.0 tags with no changes.

Thanks to the 15 community contributors who worked on this release alongside the core team.

Read the complete emdash@1.6.0 release, then follow Update EmDash to back up, build, deploy and verify the site. Remember to run the media usage repair once after you deploy.

Keep reading

All posts
  • 3 min read

    How we built collaborative editing in EmDash

    EmDash 1.5 lets several people edit one entry at the same time. Here's how we built it, from the room on the server that saves everyone's edits to the tests that make sure merges don't delete anything.

  • 19 min read

    EmDash 1.5: edit together in real time

    Turn on collaborative editing, keep a new site out of search engines until launch, send email through your own SMTP server, arrange your own admin sidebars, and edit blocks fields that you can scan at a glance.

  • 10 min read

    EmDash 1.4: fewer lost edits and many small refinements

    Edits are saved before you leave the editor, you can hide the admin areas you don't use, the editor and admin get dozens of small fixes, and the admin is complete in three more languages.