Third & GroveThird & Grove
Apr 10, 2023 - Nathaniel Catchpole

What’s Next for Drupal 10?

white tiled hallway with white tiled walls

Drupal 10 was recently released, and the momentum hasn’t stopped there. New features and API improvements are already landing, ready for Drupal 10.1.x.

A few of the enhancements include improving performance with better CSS and Javascript aggregation, reducing the headache of writing new code, and paving the way forward with community initiatives to squash bugs and fix issues.

Third and Grove’s resident core committer takes a look ahead.

Drupal 10.0

Views responsive grid

This feature is already available in Drupal 10.0.0, but it couldn’t be added to Drupal 9.5 due to Internet Explorer 11 support, so if you haven’t updated to Drupal 10, you won’t have seen it yet. Responsive grid allows you to specify the maximum number of columns, the minimum grid cell width and the gutter spacing. When the grid cells resize to a point where they’re below the minimum width, the grid will reflow to have fewer columns. Alternatively, the grid will expand to fit as many columns as permitted while keeping the grid width above the minimum value. This saves time for developers and website owners by enabling them to configure a feature that previously required custom code or contributed modules in just a couple of minutes.

Drupal 10.1

Better CSS and JavaScript aggregation

Drupal core has shipped with CSS and JavaScript aggregation for over a decade. However, the implementation had a number of issues and pre-dated Drupal’s library API.

  • Before, aggregates had to be built by the main page request.This resulted in stampedes on cold caches since no page could be served until aggregates were built and for individual pages could take hundreds of milliseconds to execution time.
  • There was no built-in JavaScript minification in core.

In Drupal 10.1, completely rewritten aggregation generation logic solves both of these issues.

  • Aggregates are now built by a dedicated route, with the main request only responsible for generating the aggregate URL based on libraries, theme, language and grouping logic. This change resolves the cold cache stampede as well as making things more robust against race conditions
  • JavaScript minification is now provided in core, using the very reliable Peast JavaScript AST parser.

This should massively reduce, if not eliminate, the need to install contributed modules to minify JavaScript. There is also renewed work to pre-minify core Javascript and use dependencies instead of weights to make things even more efficient, which will hopefully land in a later Drupal 10 release.

Constructor property promotion

When writing new Drupal code, one of the most annoying things can be the amount of boilerplate required when defining a constructor. Property declarations which are almost identical to @param documentation.

,[object Object]

Since Drupal 10 requires PHP 8.1, we can get rid of most of that boilerplate, so that exactly the same constructor looks like this instead:

,[object Object]

Much more compact with the same amount of actual implementation. This has already been adopted for new code, there’s a bit more involved to apply it to existing code.

PHP attributes

Since Drupal 8.0, Drupal has used annotations, a parseable code comment format, for defining metadata, for example for entity types. PHP 8 ships with attributes - native support for the same kinds of metadata, with less parsing overhead. Drupal 10 doesn’t yet support attributes, but we’re hoping to in Drupal 10.1 or as soon as possible, so we can start transitioning away from annotations before the libraries we rely on for parsing drop support for it.

Tidier issue queues

Drupal’s bugsmash and needs review queue initiatives have been making great progress triaging Drupal’s very long backlog. We’ve gone from around 7,000 bug reports to just over 5,000, and from around 2,700 issues needing review to around 250. Issues that have been stalled for years have been moved on and in some cases fixed. If you’d like to see old issues closed, get involved!

Further ahead

There’s lots coming up, with Project browser and Automatic updates both getting closer to the point where they can be added as experimental core modules. Look out for these in Drupal 10.2 or 10.3.