Skip to content

MarkdownFieldtype crashes when meta is null — missing optional chaining #14286

@RudyEdery

Description

@RudyEdery

Bug description

When a markdown field is inside a replicator set (without an asset container configured), the field is not rendered in the Control Panel.

The browser console shows:
TypeError: Cannot read properties of null (reading 'assets') at Proxy.container (MarkdownFieldtype-….js)

Expected: The markdown field renders normally.

Root cause: In resources/js/components/fieldtypes/markdown/MarkdownFieldtype.vue, the container() and assetSelectorColumns() computed properties access this.meta.assets without optional chaining on meta:

container() {
    return this.meta.assets?.container;  // crashes if this.meta is null
},
assetSelectorColumns() {
    return this.meta.assets?.columns;    // same issue
},

When a markdown field is inside a replicator, Field.vue resolves meta via data_get(containerMeta, path), which defaults to null (not undefined). Since null overrides the Vue prop default {}, this.meta ends up as null.

Fix: Add optional chaining on meta:

container() {
    return this.meta?.assets?.container;
},
assetSelectorColumns() {
    return this.meta?.assets?.columns;
},

Tested locally, this resolves the issue.

How to reproduce

  1. Create a blueprint with a replicator
  2. Inside that replicator, add a set containing a markdown field (no asset container configured on the field)
  3. Create or edit an entry using that blueprint in the CP
  4. Open the browser developer console
  5. The markdown field is not displayed; the TypeError appears in the console

Logs

Environment

Application Name: My Site
Laravel Version: 12.53.0
PHP Version: 8.4.19
Composer Version: 2.9.5
Environment: local
Debug Mode: OFF
URL: my-site.test
Maintenance Mode: OFF
Timezone: UTC
Locale: fr

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: sqlite
Logs: daily
Mail: smtp
Queue: redis
Session: file

Livewire
Livewire: v4.2.0

Statamic
Addons: 6
Sites: 3 (MySite FR, MySite EN, CMS)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 6.3.3 PRO

Statamic Addons
alt-design/alt-redirect: 1.7.0
aryehraber/statamic-logbook: 4.0.0
marcorieser/statamic-livewire: 5.2.1
mitydigital/statamic-google-fonts: 2.1.3
statamic/seo-pro: 7.1.0
stillat/relationships: 2.3.0

Installation

Existing Laravel app

Additional details

The bug is present on the 6.x branch on GitHub (still unfixed as of 2026-03-18). It also affects v6.5.0 and v6.7.0.
The issue likely also affects the Bard fieldtype which uses a similar pattern.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions