LeafEncoder calls fatalerror when child class implements custom encode(to:)

Hey all trying to work with contexts in leaf but running into some issues. When trying to encode a child class that implements a custom encodable conformance, the LeafEncoder calls fatalerror().

Here is example code:

class BasicData: Encodable {

    let a: String
    let b: String

    init() {
        a = "a"
        b = "b"

class AdditionalData: BasicData {
    let c: String
    let d: Int

    init(c: String, d: Int) {
        self.c = c
        self.d = d

    private enum CodingKeys: String, CodingKey {
        case c, d

    override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(self.c, forKey: .c)
        try container.encode(self.d, forKey: .d)

When trying to pass 'AdditionalData' as context to a leaf view like so:

let context = AdditionalData(c: "c", d: 4)
return try await request.view.render("leafView", context)

The LeafEncoder calls:

fatalError("Can't encode to multiple containers at the same encoding level")

The reason behind using a parent context is to include basic context information that remains constant across pages. Is this the wrong approach for this purpose? Or is this a current limitation of Leaf?